Skip to main content

Styling Elements

  • Chapter
  • First Online:
Beyond jQuery
  • 1307 Accesses

Abstract

jQuery’s internal code that backs its easy-to-use CSS API has some notable performance issues. If you value efficiency, and if you want to provide your users with an optimal experience, you should learn how to properly manipulate and read element styles using the web API. Instead of relying on a “one-size-fits-all” approach, you should choose the leanest route possible by bypassing jQuery’s abstraction.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 49.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    www.w3.org/TR/REC-CSS1/#containment-in-html

  2. 2.

    www.w3.org/TR/CSS2/

  3. 3.

    www.artima.com/intv/dry.html

  4. 4.

    https://developer.mozilla.org/en-US/docs/Web/Security/CSP/Introducing_Content_Security_Policy

  5. 5.

    www.w3.org/TR/2012/CR-CSP-20121115/

  6. 6.

    www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-ElementCSSInlineStyle

  7. 7.

    www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration

  8. 8.

    www.w3.org/TR/REC-CSS1/

  9. 9.

    www.w3.org/MarkUp/html-spec/html-spec_toc.html#SEC5.2.4

  10. 10.

    https://learn.jquery.com/using-jquery-core/css-styling-dimensions/

  11. 11.

    http://jsperf.com/jquery-css-vs-optimized-non-jquery-approach3

  12. 12.

    www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSview-getComputedStyle

  13. 13.

    http://ejohn.org/blog/selectors-that-people-actually-use/

  14. 14.

    www.w3.org/TR/html5/editing.html#the-hidden-attribute

  15. 15.

    www.html5accessibility.com/tests/hidden2013.html

  16. 16.

    www.w3.org/TR/CSS2/cascade.html#specificity

  17. 17.

    http://jsperf.com/jquery-hide-vs-setattribute-hidden

  18. 18.

    www.w3.org/TR/CSS21/box.html

  19. 19.

    www.w3.org/TR/cssom-view/#dom-element-clientwidth

  20. 20.

    www.w3.org/TR/cssom-view/#dom-element-clientheight

  21. 21.

    http://jsperf.com/innerheight-vs-element-clientheight

  22. 22.

    www.w3.org/TR/cssom-view/

  23. 23.

    www.w3.org/TR/cssom-view/#dom-htmlelement-offsetwidth

  24. 24.

    www.w3.org/TR/cssom-view/#dom-htmlelement-offsetheight

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Ray Nicholus

About this chapter

Cite this chapter

Nicholus, R. (2016). Styling Elements. In: Beyond jQuery. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-2235-5_7

Download citation

Publish with us

Policies and ethics