Skip to content

css: add note about retrieving styles for detached elements #660

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

Closed
wants to merge 1 commit into from

Conversation

arthurvr
Copy link
Member

Would fix #653

@arthurvr
Copy link
Member Author

arthurvr commented Mar 1, 2015

Somebody who wants to give this a quick review?

@@ -21,6 +21,7 @@
<p>Also, jQuery can equally interpret the CSS and DOM formatting of multiple-word properties. For example, jQuery understands and returns the correct value for both <code>.css( "background-color" )</code> and <code>.css( "backgroundColor" )</code>.</p>
<p>Note that the <em>computed style</em> of an element may not be the same as the value specified for that element in a style sheet. For example, computed styles of dimensions are almost always pixels, but they can be specified as em, ex, px or % in a style sheet. Different browsers may return CSS color values that are logically but not textually equal, e.g., #FFF, #ffffff, and rgb(255,255,255).</p>
<p>Retrieval of shorthand CSS properties (e.g., <code>margin</code>, <code>background</code>, <code>border</code>), although functional with some browsers, is not guaranteed. For example, if you want to retrieve the rendered <code>border-width</code>, use: <code>$( elem ).css( "borderTopWidth" )</code>, <code>$( elem ).css( "borderBottomWidth" )</code>, and so on.</p>
<p>An element should be connected to the DOM when calling <code>.css()</code> on it. If it isn't, jQuery will allow an error to be thrown.</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd replace "will allow an error to be thrown" with "will throw an error". It seems more readable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps "may throw an error" instead? That says it might but doesn't guarantee it will. 😄

@arthurvr arthurvr force-pushed the cssDetachedElements branch from 7f0238c to 9e970f4 Compare March 2, 2015 05:41
@arthurvr
Copy link
Member Author

arthurvr commented Mar 2, 2015

@dmethvin I pushed the update. This LGTY?

@dmethvin
Copy link
Member

dmethvin commented Mar 2, 2015

Yep, thanks!

@arthurvr arthurvr closed this in b6fb719 Mar 2, 2015
@arthurvr arthurvr deleted the cssDetachedElements branch March 2, 2015 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add note to .css() about retrieving styles for detached elements
4 participants