aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIgor Minar2013-07-24 16:42:52 -0700
committerIgor Minar2013-07-24 18:53:09 -0700
commitd87fa0042375b025b98c40bff05e5f42c00af114 (patch)
treecd2ee7f2726d0e7006d03ffd1bf5449d6cdfe9ca /src
parente03402433d2524fd3a74bbfce984f843794996ce (diff)
downloadangular.js-d87fa0042375b025b98c40bff05e5f42c00af114.tar.bz2
fix(select): don't support binding to select[multiple]
changing the type of select box from single to multiple or the other way around at runtime is currently not supported and the two-way binding does odd stuff when such situation happens. we might eventually support this, but for now we are just going to not allow binding to select[multiple] to prevent people from relying on something that doesn't work. BREAKING CHANGE: binding to select[multiple] directly or via ngMultiple (ng-multiple) directive is not supported. This feature never worked with two-way data-binding, so it's not expected that anybody actually depends on it. Closes #3230
Diffstat (limited to 'src')
-rw-r--r--src/ng/compile.js5
-rw-r--r--src/ng/directive/booleanAttrs.js39
2 files changed, 8 insertions, 36 deletions
diff --git a/src/ng/compile.js b/src/ng/compile.js
index 46ebe71a..c059af47 100644
--- a/src/ng/compile.js
+++ b/src/ng/compile.js
@@ -1220,6 +1220,11 @@ function $CompileProvider($provide) {
if (!interpolateFn) return;
+ if (name === "multiple" && nodeName_(node) === "SELECT") {
+ throw new $compileMinErr("selmulti", "Binding to the multiple attribute is not supported. Element: {0}",
+ startingTag(node));
+ }
+
directives.push({
priority: 100,
compile: valueFn(function attrInterpolateLinkFn(scope, element, attr) {
diff --git a/src/ng/directive/booleanAttrs.js b/src/ng/directive/booleanAttrs.js
index 8f7399a6..a0966da7 100644
--- a/src/ng/directive/booleanAttrs.js
+++ b/src/ng/directive/booleanAttrs.js
@@ -201,42 +201,6 @@
/**
* @ngdoc directive
- * @name ng.directive:ngMultiple
- * @restrict A
- *
- * @description
- * The HTML specs do not require browsers to preserve the special attributes such as multiple.
- * (The presence of them means true and absence means false)
- * This prevents the angular compiler from correctly retrieving the binding expression.
- * To solve this problem, we introduce the `ngMultiple` directive.
- *
- * @example
- <doc:example>
- <doc:source>
- Check me check multiple: <input type="checkbox" ng-model="checked"><br/>
- <select id="select" ng-multiple="checked">
- <option>Misko</option>
- <option>Igor</option>
- <option>Vojta</option>
- <option>Di</option>
- </select>
- </doc:source>
- <doc:scenario>
- it('should toggle multiple', function() {
- expect(element('.doc-example-live #select').prop('multiple')).toBeFalsy();
- input('checked').check();
- expect(element('.doc-example-live #select').prop('multiple')).toBeTruthy();
- });
- </doc:scenario>
- </doc:example>
- *
- * @element SELECT
- * @param {expression} ngMultiple Angular expression that will be evaluated.
- */
-
-
-/**
- * @ngdoc directive
* @name ng.directive:ngReadonly
* @restrict A
*
@@ -334,6 +298,9 @@ var ngAttributeAliasDirectives = {};
// boolean attrs are evaluated
forEach(BOOLEAN_ATTR, function(propName, attrName) {
+ // binding to multiple is not supported
+ if (propName == "multiple") return;
+
var normalized = directiveNormalize('ng-' + attrName);
ngAttributeAliasDirectives[normalized] = function() {
return {