mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-22 01:10:23 +00:00
use special nodeName_ impl only for IE<9
apparently IE9 is one step closer to becoming a real browser by
treating xmlns-like ("foo:") prefixes in node names as part of the
node name.
fixes:
https://groups.google.com/forum/?lnk=srg#!topic/angular/TGdrV4GsL8U
This commit is contained in:
parent
d517bcad5b
commit
0d2d7025e6
2 changed files with 22 additions and 1 deletions
|
|
@ -428,7 +428,7 @@ function HTML(html, option) {
|
|||
};
|
||||
}
|
||||
|
||||
if (msie) {
|
||||
if (msie < 9) {
|
||||
nodeName_ = function(element) {
|
||||
element = element.nodeName ? element : element[0];
|
||||
return (element.scopeName && element.scopeName != 'HTML' ) ? uppercase(element.scopeName + ':' + element.nodeName) : element.nodeName;
|
||||
|
|
|
|||
|
|
@ -562,4 +562,25 @@ describe('angular', function(){
|
|||
expect(scope.greeting).toEqual('hello world');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('nodeName_', function() {
|
||||
it('should correctly detect node name with "namespace" when xmlns is defined', function() {
|
||||
var div = jqLite('<div xmlns:ngtest="http://angularjs.org/">' +
|
||||
'<ngtest:foo ngtest:attr="bar"></ng:test>' +
|
||||
'</div>')[0];
|
||||
expect(nodeName_(div.childNodes[0])).toBe('NGTEST:FOO');
|
||||
expect(div.childNodes[0].getAttribute('ngtest:attr')).toBe('bar');
|
||||
});
|
||||
|
||||
if (!msie || msie >= 9) {
|
||||
it('should correctly detect node name with "namespace" when xmlns is NOT defined', function() {
|
||||
var div = jqLite('<div xmlns:ngtest="http://angularjs.org/">' +
|
||||
'<ngtest:foo ngtest:attr="bar"></ng:test>' +
|
||||
'</div>')[0];
|
||||
expect(nodeName_(div.childNodes[0])).toBe('NGTEST:FOO');
|
||||
expect(div.childNodes[0].getAttribute('ngtest:attr')).toBe('bar');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue