-
Notifications
You must be signed in to change notification settings - Fork 47k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOMLazyTree, populate <object> before insertion into DOM #6691
Conversation
Any idea whether video/audio source/track are affected too? |
@spicyj I can't see why they would be, this feels like idiosyncratic behavior for |
This looks fine to me, so unless anyone has any objections, I'm going to tentatively accept. @syranide Do you have a demo/example that demonstrates the problem, so we can verify the fix and also see when we regress this? |
@jimfb http://dev.cetrez.com/jsx/swffail.html (jsfiddle not possible due to sandboxing) On IE (lazy populate) |
👍 Great, thanks @syranide! Reposting the relevant code here, just so it doesn't get lost if the file on dev.cetrez.com goes away. <script>
var Hello = React.createClass({
render: function() {
return (
React.createElement('object', {type: 'application/x-shockwave-flash', data: 'awd', width: 200, height: 200}, [
React.createElement('param', {name: 'movie', value: 'awd'}),
React.createElement('param', {name: 'bgcolor', value: '#0000ff'})
])
);
}
});
ReactDOM.render(
React.createElement(Hello),
document.getElementById('container')
);
document.body.style.background = '#cc0000';
</script> |
// <param> nodes immediately upon insertion into the DOM, so <object> | ||
// must also be populated prior to insertion into the DOM. | ||
if (tree.node.nodeType === 11 || | ||
tree.node.nodeName && tree.node.nodeName.toLowerCase() === 'object') { |
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.
Can we do tree.node.nodeType === 1 && tree.node.nodeName === 'OBJECT' && (tree.node.namespaceURI == null || tree.node.namespaceURI === DOMNamespaces.html)
? Otherwise I suppose I'm good with this.
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.
Sure thing, that seems like a better test (and no toLowerCase()
👍). I'm just curious though, elsewhere we use the test I implemented above, is that just a transitional thing and to be replaced?
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.
Oh right, I don't think this will work for true XHTML-documents? nodeName
is reported with the case as-is there IIRC? (hence toLowerCase()
)
Thanks for sending, just one note inline and then feel free to merge. |
Updated the PR but #6691 (comment) needs an answer. PS. I also took the liberty of adding constants for the nodeTypes like sporadically done elsewhere. |
You're right, let's keep the toLowerCase. Forgot about the XHTML case. |
Thanks! |
(cherry picked from commit 2af4765)
Ok, so apparently this still doesn't work in IE9 and ooooh weeee, it's seemingly impossible to make it work in IE9! The only way is to create the object and params together using innerHTML (swfobject has an explicit code path for that too). But AFAIK that's not really realistic and IE9 is on the shortlist so I doubt it's worth the headache. |
Fix for #6629 and replaces the broken PR #6640.
Again, real-life performance implications unknown. As far as I can tell and understand it, it works as intended and considering the simplicity I fail to see how this could break anything.