• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

"Pro CSS and HTML Design Patterns" question: does it cover javascript too?

 
Ranch Hand
Posts: 701
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I'd like to know if the book also cover about javascript, too, because it is a subject that is very related to it.

Regards
 
Author
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does "Pro CSS and HTML Design Patterns" cover JavaScript?

Pro CSS and HTML Design Patterns does not teach JavaScript and it is not about JavaScript, but it does contain a few design patterns that use JavaScript. The purpose of these patterns is to show best practices for using JavaScript to style XHTML using CSS.

One best practice for using JavaScript with CSS is to use JavaScript to modify the class attributes of an element to dynamically change how the element is styled. This is the best way for JavaScript to modify the style of an element: CSS defines the style through a class and JavaScript dynamically assigns classes to elements.

As a complement to the best practice of using JavaScript to modify only the class attributes of elements, my book advocates selecting XHTML elements in JavaScript using the CSS selector syntax. This approach allows you to use the same CSS selectors to select elements in CSS and in JavaScript. Using the same selector syntax makes CSS and JavaScript code more intuitive and more maintainable. You have to read Chapter 17 of my book to see how cool this is.

To select elements in JavaScript using CSS selector syntax, you need a JavaScript library. I provide just such a library in my book (http://cssdesignpatterns.com). It is modular and extensible, and it makes it easy to dynamically style elements using this technique. This library uses the Yahoo event library which unifies event handling across the different browsers (http://developer.yahoo.com/yui/event/). It also uses uses the cssQuery library created by Dean Edwards (http://dean.edwards.name/my/cssQuery/)

Lastly, I show in the book how to use JavaScript without inserting a single line of JavaScript into the body of an HTML document! This is really cool stuff and makes for a very clean separation of design (CSS), structure (XHTML), and interaction (JavaScript)!
 
He puts the "turd" in "saturday". Speaking of which, have you smelled this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic