Unobtrusive Markup with Prototype

Being a big fan of unobtrusive ways to add new features to existing things, thus keeping downgradability, I couldn’t help noticing this post by Ryan J Lowe where he explains how to make rounded borders with just a bit of Prototype magic and onDOMReady Fairy Dust:
I have seen some really neet tricks using CSS to perform various layouts and designs. But along with these new tricks, can come a lot of markup cost. Even by getting the markup down to as small as possible, there is a lot of duplicated markup out there. I have found that a lot of this extra markup could be taken care of by the use of some simple javascript calls from the Prototype Framework.
With his neat trick this:
<div class="old_corners">
<div class="cornert"><div></div></div>
blah blah blah
<div class="cornerb"><div></div></div>
</div>
becomes this:
<div class="corners">
new blah blah
</div>
Technorati Tags: , , ,
Did you like this? Share it:

Leave a Reply