Do not browser sniff when forking unmark
function in selector suite. Instead use a proper test - PROPERTIES_ATTRIBUTES_MAP.
This commit is contained in:
parent
74374347c1
commit
cebf7d673b
@ -1,3 +1,5 @@
|
||||
* Do not browser sniff when forking `unmark` function in selector suite. Instead use a proper test - PROPERTIES_ATTRIBUTES_MAP. (kangax)
|
||||
|
||||
* Do not use short-hand element methods notation (@element.getStyle() -> Element.getStyle(@element)) for performance reasons. Do not use `$A` and `Array.prototype.shift` when `Array.prototype.slice` can be used instead. (kangax)
|
||||
|
||||
* `Prototype.Browser.Opera` now uses stronger inference and is determined by [[Class]] of `window.opera` being - "Opera". (kangax)
|
||||
|
@ -437,11 +437,33 @@ Object.extend(Selector, {
|
||||
return nodes;
|
||||
},
|
||||
|
||||
unmark: function(nodes) {
|
||||
for (var i = 0, node; node = nodes[i]; i++)
|
||||
node._countedByPrototype = undefined;
|
||||
return nodes;
|
||||
},
|
||||
unmark: (function(){
|
||||
|
||||
// IE improperly serializes _countedByPrototype in (inner|outer)HTML
|
||||
// due to node properties being mapped directly to attributes
|
||||
var PROPERTIES_ATTRIBUTES_MAP = (function(){
|
||||
var el = document.createElement('div'),
|
||||
isBuggy = false,
|
||||
propName = '_countedByPrototype',
|
||||
value = 'x'
|
||||
el[propName] = value;
|
||||
isBuggy = (el.getAttribute(propName) === value);
|
||||
el = null;
|
||||
return isBuggy;
|
||||
});
|
||||
|
||||
return PROPERTIES_ATTRIBUTES_MAP ?
|
||||
function(nodes) {
|
||||
for (var i = 0, node; node = nodes[i]; i++)
|
||||
node.removeAttribute('_countedByPrototype');
|
||||
return nodes;
|
||||
} :
|
||||
function(nodes) {
|
||||
for (var i = 0, node; node = nodes[i]; i++)
|
||||
node._countedByPrototype = void 0;
|
||||
return nodes;
|
||||
}
|
||||
})(),
|
||||
|
||||
// mark each child node with its position (for nth calls)
|
||||
// "ofType" flag indicates whether we're indexing for nth-of-type
|
||||
@ -831,13 +853,6 @@ if (Prototype.Browser.IE) {
|
||||
for (var i = 0, node; node = b[i]; i++)
|
||||
if (node.tagName !== "!") a.push(node);
|
||||
return a;
|
||||
},
|
||||
|
||||
// IE improperly serializes _countedByPrototype in (inner|outer)HTML.
|
||||
unmark: function(nodes) {
|
||||
for (var i = 0, node; node = nodes[i]; i++)
|
||||
node.removeAttribute('_countedByPrototype');
|
||||
return nodes;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user