Remove unnecessary function object creation and Number#times in Element._getContentFromAnonymousElement.

This commit is contained in:
Juriy Zaytsev 2009-11-13 14:21:14 -05:00
parent 9ef3f8d2ed
commit 82c9b9c783
2 changed files with 11 additions and 3 deletions

View File

@ -1,3 +1,5 @@
* Remove unnecessary function object creation and `Number#times` in `Element._getContentFromAnonymousElement`. (kangax)
* Eliminate runtime forking and long method lookup in `Element.hasAttribute`. (kangax)
* Remove redundant ternary. (kangax)

View File

@ -1868,11 +1868,17 @@ Element._returnOffset = function(l, t) {
};
Element._getContentFromAnonymousElement = function(tagName, html) {
var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
var div = new Element('div'),
t = Element._insertionTranslations.tags[tagName];
if (t) {
div.innerHTML = t[0] + html + t[1];
t[2].times(function() { div = div.firstChild });
} else div.innerHTML = html;
for (var i = t[2]; i--; ) {
div = div.firstChild;
}
}
else {
div.innerHTML = html;
}
return $A(div.childNodes);
};