Skip to content

Conversation

@rwaldron
Copy link
Member

No description provided.

@paulirish
Copy link
Member

@paulirish
Copy link
Member

You're aliasing window.getComputedStyle as a local getComputedStyle variable but that seems needless.
Instead, just check (window.getComputedStyle) in the conditionals and use it straight out within the block.

doing this you'd save another 4 (OMG FOUR!) bytes

@rwaldron
Copy link
Member Author

247971   (-266) jquery.js
 93914   (-103) jquery.min.js
 33197    (-16) jquery.min.js.gz         

@davidmurdoch
Copy link

@mikesherov
Copy link
Member

@jdalton, just curious... what difference does it make if we're using the getComputedStyle function of the window instead of the same function on the ownerDocument?

@timmywil
Copy link
Member

I share the same concern as @jdalton.

@rwaldron
Copy link
Member Author

@jdalton thanks for the heads up, ping me on IRC :)

@jdalton
Copy link
Member

jdalton commented Sep 29, 2011

@davidmurdoch @mikesherov One of the cool things about being document agnostic is that you can have jQuery in one (i)frame/primary document and script elements in other (i)frames w/o also having jQuery loaded in all (i)frames. I'm not sure how much compat jQuery has for this, but I thought it was a rad enough feature to add to my own lib. So basically before:

  // elem is from another iframe so its document, window, & defaultView are different
  elem.ownerDocument.defaultView

Using the primary window's method kills that functionality.
The use of ownerDocument and the private getWindow() function makes me think that at one time cross-frame scripting was considered a feature.

@rwaldron
Copy link
Member Author

@gnarf
Copy link
Member

gnarf commented Sep 29, 2011

@jdalton - Little bit of research here - getComputedStyle doesn't seem to care what window its on...

@jdalton
Copy link
Member

jdalton commented Sep 29, 2011

It doesn't get the same result in FF 3.6; see this test.
The reason this raised red flags for me is normally foreign nodes cause errors to be thrown when inserting/attempting-to-mix-with the primary document's nodes.

@rwaldron
Copy link
Member Author

Thanks @jdalton ... I just confirmed that FF3.6 is indeed unable to get the computed style unless called from the correct context

Perhaps when FF3.6 is EOL'ed, we can re-open this

@rwaldron rwaldron closed this Sep 29, 2011
@gnarf
Copy link
Member

gnarf commented Sep 29, 2011

lame - but awesome - thanks for finding the hole @jdalton

@jdalton
Copy link
Member

jdalton commented Sep 29, 2011

It doesn't work in Fennec either (produces the same result as FF 3.6)

@lock lock bot locked as resolved and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

7 participants