Commit
… defficiency is detected. Avoid APPLET elements creation in that test, since it triggers warning in clients without Java. [#668 state:resolved][#681 state:resolved] (Nick Stakenburg, orv, Andrew Dupont, kangax)
- Loading branch information
There are no files selected for viewing
6 comments
on commit 9020365
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two other comments:
I can't see any caching mechanisme for either of those 3 special elements. Is there a reason for this ?
What happened to simulated methods (I know hasAttribute
was fixed in IE 8 but I really dislike the idea of keeping a half baked mechanism around)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it's a shame you can't preview comments at the bottom of the page :/
Also, wished MArkdown didn't use # for marking titles when Textile uses it to create numbered lists :|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damn. If we remove t = element.tagName
, the whole thing becomes ugly :/ Good call about caching, I forgot about it. What about simulated? Element.Methods.Simulated
is still in the source.
Here's an updated assignment-in-an-if-expression-less version:
if (HTMLOBJECTELEMENT_PROTOTYPE_BUGGY) {
return function(element) {
if (element && typeof element._extendedByPrototype == 'undefined') {
var t = element.tagName;
if (t) {
if (/^(?:object|applet|embed)$/i.test(t)) {
extendElementWith(element, Element.Methods);
extendElementWith(element, Element.Methods.ByTag[t.toUpperCase()]);
}
}
}
return element;
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those 2 if
don't make much sense, of course:
if (HTMLOBJECTELEMENT_PROTOTYPE_BUGGY) {
return function(element) {
if (element && typeof element._extendedByPrototype == 'undefined') {
var t = element.tagName;
if (t && /^(?:object|applet|embed)$/i.test(t)) {
extendElementWith(element, Element.Methods);
extendElementWith(element, Element.Methods.ByTag[t.toUpperCase()]);
}
}
return element;
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about simply using an early return like it's done in the original function ?
Also, why are you guarding against null or empty tagNames, when is that an issue?
Regarding Simulated methods, would those be added to object
, applet
or embed
tags? I'm not sure from the code I see above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about simply using an early return like it's done in the original function?
Does it really matter?
Also, why are you guarding against null or empty tagNames, when is that an issue?
When a non-element is passed into Element.extend (e.g. document or window)
Regarding Simulated methods, would those be added to object, applet or embed tags? I'm not sure from the code I see above.
Just checked - they are not added. It "works" because hasAttribute (the only method in Simulated) is implemented natively in IE8. This is clearly an oversight, since our docs, at least, guarantee that all of Simulated methods exist on extended elements.
I know it's a pain to write this kind of construct otherwise... but I'd vote for avoiding those whenever possible (except in while loops maybe, where they kind of make sense).