diff options
| author | Misko Hevery | 2011-02-03 12:25:51 -0800 | 
|---|---|---|
| committer | Misko Hevery | 2011-02-03 13:25:01 -0800 | 
| commit | b6a01bd27dbcd2f9c9df917ecc96b8a2bd88413d (patch) | |
| tree | 9ae08321a3741520014eac4d751a23ac39ab5f7e /src/markups.js | |
| parent | aaaad298ac6447497b1b86edac5b0d9b092625a2 (diff) | |
| download | angular.js-b6a01bd27dbcd2f9c9df917ecc96b8a2bd88413d.tar.bz2 | |
fixed population of value attribute on option
The value attribute must be populated manually, since different
browsers default to different value of option when not explicitly
defined.
Diffstat (limited to 'src/markups.js')
| -rw-r--r-- | src/markups.js | 17 | 
1 files changed, 12 insertions, 5 deletions
| diff --git a/src/markups.js b/src/markups.js index 21dab128..0aa7170e 100644 --- a/src/markups.js +++ b/src/markups.js @@ -60,11 +60,18 @@ angularTextMarkup('{{}}', function(text, textNode, parentElement) {  // TODO: this should be widget not a markup  angularTextMarkup('OPTION', function(text, textNode, parentElement){    if (nodeName_(parentElement) == "OPTION") { -    var select = document.createElement('select'); -    select.insertBefore(parentElement[0].cloneNode(true), _null); -    if (!select.innerHTML.match(/<option(\s.*\s|\s)value\s*=\s*.*>.*<\/\s*option\s*>/gi)) { -      parentElement.attr('value', text); -    } +    var select = jqLite('<select>'); +    select.append(parentElement.clone()); +    htmlParser(select.html(), { +      start: function(tag, attrs) { +        if (isUndefined(attrs.value)) { +          parentElement.attr('value', text); +        } +      }, +      chars: noop, +      end: noop, +      comment: noop +    });    }  }); | 
