Skip to content
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

fallback to elem.style for disconnected nodes, fixes #10254 and #8388 #553

Closed
wants to merge 4 commits into from

Conversation

Projects
None yet
2 participants
@mikesherov
Copy link
Member

commented Oct 17, 2011

disconnected nodes don't have currentStyle in IE<9!

src/css.js Outdated
@@ -290,6 +290,10 @@ if ( document.documentElement.currentStyle ) {
rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ],
style = elem.style;

if ( !ret && style ) {

This comment has been minimized.

Copy link
@timmywil

timmywil Oct 18, 2011

Member

it's ok if ret is 0 here right? maybe this should be ret === undefined

This comment has been minimized.

Copy link
@mikesherov

mikesherov Oct 18, 2011

Author Member

hmmm... maybe. I'm not sure it's undef... we may also want to be checking empty strings and null as well. checking for 0 is a perf. optimization... so I'm not 100% sure it'll work in all cases.

This comment has been minimized.

Copy link
@timmywil

timmywil Oct 20, 2011

Member

I don't think we should check for null and I really don't think we need to check for 0. Getting a null value would only occur when the specific style does not exist on currentStyle, in which case it should return null. And 0 can be a valid computed value that should not be changed.

This comment has been minimized.

Copy link
@mikesherov

mikesherov Oct 20, 2011

Author Member

OK, so just check for undef it is... I'll make sure the unit test passes here. Thanks!

This comment has been minimized.

Copy link
@mikesherov

mikesherov Oct 20, 2011

Author Member

@timmywil, i just tested this. IE8 returns null in my unit tests... i need to check for null/undefined for disconnected nodes! i can get rid of the 0 check though, i think.

This comment has been minimized.

Copy link
@timmywil

timmywil Oct 20, 2011

Member

It's returning null for a non-existent property? I guess the property exists, but IE chooses to return null on disconnected nodes?

This comment has been minimized.

Copy link
@timmywil

timmywil Oct 20, 2011

Member

Ok, then just a check for null should be sufficient. When you said "don't have currentStyle", I assumed the property was non-existent.

This comment has been minimized.

Copy link
@mikesherov

mikesherov Oct 20, 2011

Author Member

it returns null for the currentStyle property, and the right value in elem.style for background-image and top.

@timmywil

This comment has been minimized.

Copy link
Member

commented Oct 22, 2011

Landed in commit e502012.

@timmywil timmywil closed this Oct 22, 2011

mescoda pushed a commit to mescoda/jquery that referenced this pull request Nov 4, 2014

@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.