<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Thoughts From Eric &#187; DOM</title>
	<atom:link href="http://meyerweb.com/eric/thoughts/category/tech/dom/feed/" rel="self" type="application/rss+xml" />
	<link>http://meyerweb.com/eric/thoughts</link>
	<description>Things that Eric A. Meyer, CSS expert, writes about on his personal Web site; it&#039;s largely Web standards and Web technology, but also various bits of culture, politics, personal observations, and other miscellaneous stuff</description>
	<lastBuildDate>Thu, 09 Feb 2012 18:37:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Turning Web Video On Its Head</title>
		<link>http://meyerweb.com/eric/thoughts/2010/04/07/turning-web-video-on-its-head/</link>
		<comments>http://meyerweb.com/eric/thoughts/2010/04/07/turning-web-video-on-its-head/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 18:46:45 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[Humor]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/?p=1314</guid>
		<description><![CDATA[Here's some fun.  (For a sufficiently nerdy definition of "fun".)]]></description>
			<content:encoded><![CDATA[<p>
Here&#8217;s some fun.  (For a sufficiently nerdy definition of &#8220;fun&#8221;.)
</p>

<ol>
	<li><p>Launch Safari 4 or Chrome 4.</p></li>
	<li><p>Drag <a href="javascript:(function(){var d=0;setInterval(function(){document.getElementsByTagName('video')[0].style['-webkit-transform']='rotate('+d+'deg)';d+=1},100)}());">Videotate</a> to the bookmarks bar.</p></li>
	<li><p>Go <a href="http://youtube.com/html5">opt into the YouTube HTML5 beta</a>.</p></li>
	<li><p>Find your favorite YouTube video.  Or maybe your least favorite.  Here&#8217;s one of my favorites: <a href="http://www.youtube.com/watch?v=9V5ubAOeOBk">Walk Don&#8217;t Run</a>.  Here&#8217;s <a href="http://www.youtube.com/watch?v=v82JqQAQqLE">another that&#8217;s not necessarily a favorite</a>, but it seems like a fairly appropriate choice.</p><p><strong>Note:</strong> not all videos are available via HTML5, even when you&#8217;re opted in.  If you get a Flash video, the bookmarklet won&#8217;t work.</p></li>
	<li><p>Once the video has started playing, activate the &#8220;Videotate&#8221; bookmarklet.</p></li>
	<li><p>Enjoy.</p></li>
</ol>

<p>
Thanks to <a href="http://simonwillison.net/" rel="acquaintance colleague met">Simon WIllison</a> for <a href="http://twitter.com/simonw/status/825123672">tweeting the JS</a> I modified, and <a href="http://adactio.com/" rel="friend colleague met">Jeremy Keith</a> for helping me realize it would be easy to do during the HTML5 portion of <a href="http://aneventapart.com/2010/seattle/#dayapart">A Day Apart</a>.
</p>
]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2010/04/07/turning-web-video-on-its-head/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Pseudo-Phantoms</title>
		<link>http://meyerweb.com/eric/thoughts/2009/11/03/pseudo-phantoms/</link>
		<comments>http://meyerweb.com/eric/thoughts/2009/11/03/pseudo-phantoms/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 17:41:10 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/?p=1180</guid>
		<description><![CDATA[In the course of a recent debugging session, I discovered a limitation of web inspectors (Firebug, Dragonfly, Safari&#8217;s Web Inspector, et al.) that I hadn&#8217;t quite grasped before: they don&#8217;t show pseudo-elements and they&#8217;re not so great with pseudo-classes. There&#8217;s one semi-exception to this rule, which is Internet Explorer 8&#8242;s built-in Developer Tool. It shows [...]]]></description>
			<content:encoded><![CDATA[<p>
In the course of a recent debugging session, I discovered a limitation of web inspectors (Firebug, Dragonfly, Safari&#8217;s Web Inspector, et al.) that I hadn&#8217;t quite grasped before: they don&#8217;t show pseudo-elements and they&#8217;re not so great with pseudo-classes.  There&#8217;s one semi-exception to this rule, which is Internet Explorer 8&#8242;s built-in Developer Tool.  It shows pseudo-elements just fine.
</p>
<p>
Here&#8217;s an example of what I&#8217;m talking about:
</p>

<pre><code>p::after {content: " -\2761-"; font-size: smaller;}
</code></pre>

<p>
Drop that style into any document that has paragraphs.  Load it up in your favorite development browser.  Now inspect a paragraph.  You will not see the generated content in the DOM view, and you won&#8217;t see the pseudo-element rule in the Styles tab (except in IE, where you get the latter, though not the former).
</p>

<a href="http://www.flickr.com/photos/meyerweb/4071955467/"><img src="http://meyerweb.com/pix/2009/firebug-crop.png" class="pic border" alt="" /></a>

<p>
The problem isn&#8217;t that I used an escaped Unicode reference; take that out and you&#8217;ll still see the same results, as on <a href="http://meyerweb.com/eric/css/tests/pseudos-inspector-test.html">the test page I threw together</a>.  It isn&#8217;t the double-colon syntax, either, which all modern browsers handle just fine; and anyway, I can take it back to a single colon and still see the same results.  <code>::first-letter</code>, <code>::first-line</code>, <code>::before</code>, and <code>::after</code> are all basically invisible in most inspectors.
</p>
<p>
This can be a problem when developing, especially in cases such as having a forgotten, runaway <a href="http://www.positioniseverything.net/easyclearing.html">generated-content clearfix</a> making hash of the layout.  No matter how many times you inspect the elements that are behaving strangely, you aren&#8217;t going to see anything in the inspector that tells you why the weirdness is happening.
</p>
<p>
The same is largely true for dynamic pseudo-classes.  If you style all five link states, only two will show up in most inspectors&#8212;either <code>:link</code> or <code>:visited</code>, depending on whether you&#8217;ve visited the link&#8217;s target; and <code>:focus</code>.  (You can sometimes also get <code>:hover</code> in Dragonfly, though I&#8217;ve not been able to do so reliably.  IE8&#8242;s Developer Tool always shows <code>a:link</code> even when the link is visited, and doesn&#8217;t appear to show any other link states.  &#8230;yes, this is getting complicated.)
</p>
<p>
The more static pseudo-classes, like <code>:first-child</code>, do show up pretty well across the board (except in IE, which doesn&#8217;t support all the advanced static pseudo-classes; e.g., <code>:last-child</code>).
</p>

<a href="http://www.flickr.com/photos/meyerweb/4072718108/"><img src="http://meyerweb.com/pix/2009/iedevtool-crop.png" class="pic border" alt="" /></a>

<p>
I can appreciate that inspectors face an interesting challenge here.  Pseudo-elements are just that, and aren&#8217;t part of the actual structure.  And yet Internet Explorer&#8217;s Developer Tool manages to find those rules and display them without any fuss, even if it doesn&#8217;t show generated content in its DOM view.  Some inspectors do better than others with dynamic pseudo-classes, but the fact remains that you basically can&#8217;t see some of them even though they will potentially apply to the inspected link at some point.
</p>
<p>
I&#8217;d be very interested to know what inspector teams encountered in trying to solve this problem, or if they&#8217;ve never tried.  I&#8217;d be <em>especially</em> interested to know why IE shows pseudo-elements when the others don&#8217;t&#8212;is it made simple by their rendering engine&#8217;s internals, or did someone on the Developer Tool team go to the extra effort of special-casing those rules?
</p>
<p>
For me, however, the overriding question is this: what will it take for the various inspectors to behave more like IE&#8217;s does, and show pseudo-element and pseudo-class rules that are associated with the element currently being inspected?  And as a bonus, to get them to show in the DOM view where the pseudo-elements actually live, so to speak?
</p>
<p>
<small>(<strong>Addendum:</strong> when I talk about IE and the Developer Tool in this post, I mean the tool built into IE8.  I did not test the Developer Toolbar that was available for IE6 and IE7.  Thanks to <a href="http://www.bogglethemind.com/">Jeff L</a> for pointing out the need to be clear about that.)</small>
</p>]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2009/11/03/pseudo-phantoms/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>JavaScript Will Save Us All</title>
		<link>http://meyerweb.com/eric/thoughts/2008/10/22/javascript-will-save-us-all/</link>
		<comments>http://meyerweb.com/eric/thoughts/2008/10/22/javascript-will-save-us-all/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 13:05:57 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Standards]]></category>

		<guid isPermaLink="false">http://meyerweb.com/?p=953</guid>
		<description><![CDATA[Most of the browser development work these days seems to be going into JavaScript performance.  That's a good thing for CSS3 and HTML5.]]></description>
			<content:encoded><![CDATA[<p>
A while back, I woke up one morning thinking, <i>John Resig&#8217;s got some great CSS3 support in <a href="http://jquery.com/">jQuery</a> but it&#8217;s all forced into JS statements.  I should ask him if he could set things up like <a href="http://dean.edwards.name/">Dean Edwards</a>&#8216; <a href="http://dean.edwards.name/ie7/">IE7 script</a> so that the JS scans the author&#8217;s CSS, finds the advanced selectors, does any necessary backend juggling, and makes CSS3 selector support Transparently Just Work.  And then he could put that back into jQuery.</i>
</p>
<p>
And then, after breakfast, I fired up my feed reader and saw <a href="http://simonwillison.net/" rel="acquaintance met">Simon Willison</a>&#8216;s <a href="http://simonwillison.net/2008/Aug/24/jeresigs/">link</a> to John Resig&#8217;s nascent <a href="http://github.com/jeresig/sizzle/tree/master">Sizzle</a> project.
</p>
<p>
I swear to Ged this is how it happened.
</p>
<p>
Personally, I can&#8217;t wait for Sizzle to be finished, because I&#8217;m absolutely going to use it and recommend its use far and wide.  As far as I&#8217;m concerned, though, it&#8217;s a first step into a larger world.
</p>
<p>
Think about it: most of the browser development work these days seems to be going into JavaScript performance.  Those engines are being overhauled and souped up and tuned and re-tuned to the point that performance is improving by orders of magnitude.  Scanning the DOM tree and doing things to it, which used to be slow and difficult, is becoming lightning-fast and easy.
</p>
<p>
So why not write JS to implement <a href="http://www.css3.info/preview/multiple-backgrounds/">multiple background-image</a> support in all browsers?  All that&#8217;s needed is to scan the CSS, find instances of multiple-image backgrounds, and then dynamically add <code>div</code>s, one per extra background image, to get the intended effect.
</p>
<p>
Just like that, you&#8217;ve used the browser&#8217;s JS to extend its CSS support.  This approach advances standards support in browsers from the ground up, instead of waiting for the browser teams to do it for us.
</p>
<p>
I suspect that not quite everything in CSS3 will be amenable to this approach, but you might be surprised.  Seems to me that you could do <a href="http://www.css3.info/preview/background-size/">background sizing</a> with some <code>div</code>-and-positioning tricks, and <code>text-shadow</code> could be supportable using a sIFR-like technique, though line breaks would be a bear to handle.  <a href="http://www.w3.org/TR/2003/CR-css3-color-20030514/#rgba-color">RGBa</a> and <a href="http://www.w3.org/TR/2003/CR-css3-color-20030514/#hsla-color">HSLa</a> colors could be simulated with creative element reworking and <code>opacity</code>, and HSL itself could be (mostly?) supported in IE with HSL-to-RGB calculations.  And so on.
</p>
<p>
There are two primary benefits here.  The first is obvious: we can stop waiting around for browser makers to give us what we want, thanks to their efforts on JS engines, and start using the advanced CSS we&#8217;ve been hearing about for years.  The second is that the process of finding out which parts of the spec work in the real world, and which fall down, will be greatly accelerated.  If it turns out nobody uses (say) <code>background-clip</code>, even given its availability via a CSS/JS library, then that&#8217;s worth knowing.
</p>
<p>
What I wonder is whether the W3C could be convinced that two JavaScript libraries supporting a given CSS module would constitute &#8220;interoperable implementations&#8221;, and thus allow the specification to move forward on the process track.  Or heck, what about considering a single library getting consistent support in two or more browsers as interoperable?  There&#8217;s a chance here to jump-start the entire process, front to back.
</p>
<p>
It is true that browsers without JavaScript will not get the advanced CSS effects, but older browsers don&#8217;t get our current CSS, and we use it anyway.  (Still older browsers don&#8217;t understand any CSS at all.)  It&#8217;s the same problem we&#8217;ve always faced, and everyone will face it differently.
</p>
<p>
We don&#8217;t have to restrict this to CSS, either.  As I showed with my <a href="http://meyerweb.com/eric/html-xhtml/html5-linking-demo.html"><code>href</code>-anywhere demo</a>, it&#8217;s possible to extend markup using JS.  (No, not without breaking validation: you&#8217;d need a custom DTD for that.  Hmmm.)  So it would be possible to use JS to, say, add <code>audio</code> and <code>video</code> support to currently-available browsers, and even older browsers.  All you&#8217;d have to do is convert the HTML5 element into HTML4 elements, dynamically writing out the needed attributes and so forth.  It might not be a perfect 1:1 translation, but it would likely be serviceable&#8212;and would tear down some of the highest barriers to adoption.
</p>
<p>
There&#8217;s more to consider, as well: the ability to create our very own &#8220;standards&#8221;.  Maybe you&#8217;ve always wanted a <code>text-shake</code> property, which jiggles the letters up and down randomly to look like the element got shaken up a bit.  Call it <code>-myCSS-text-shake</code> or something else with a proper &#8220;vendor&#8221; prefix&#8212;we&#8217;re <em>all</em> vendors now, baby!&#8212;and go to town.  Who knows?  If a property or markup element or attribute suddenly takes off like wildfire, it might well make it into a specification.  After all, the HTML 5 Working Group is now explicitly set up to prefer things which are implemented over things that are not.  Perhaps the CSS Working Group would move in a similar direction, given a world where we were all experimenting with our own ideas and seeing the best ideas gain widespread adoption.
</p>
<p>
In the end, <a href="http://www.flickr.com/photos/rohdesign/2951537617/">as I said in Chicago</a> last week, the triumph of standards (specifically, the DOM standard) will permit us to push standards support forward <em>now</em>, and save some standards that are currently dying on the vine.  All we have to do now is start pushing.  Sizzle is a start.  Who will take the next step, and the step after that?
</p>
]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2008/10/22/javascript-will-save-us-all/feed/</wfw:commentRss>
		<slash:comments>67</slash:comments>
		</item>
		<item>
		<title>Reserved ID Values?</title>
		<link>http://meyerweb.com/eric/thoughts/2005/08/29/reserved-id-values/</link>
		<comments>http://meyerweb.com/eric/thoughts/2005/08/29/reserved-id-values/#comments</comments>
		<pubDate>Mon, 29 Aug 2005 21:42:21 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[DOM]]></category>

		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2005/08/29/reserved-id-values/</guid>
		<description><![CDATA[There may be more problems in IE/WIn than just 'id="tags"'.]]></description>
			<content:encoded><![CDATA[<p>
As a followup to my <a href="http://meyerweb.com/eric/thoughts/2005/08/26/when-printing-kills/">entry about <code>id="tags"</code></a> causing problems in IE/Win, here are <del>four</del> five test pages for IE/Win:
</p>

<ul>
<li><a href="http://meyerweb.com/eric/tests/ie-reserved-length.html">IE Keyword Testing (length)</a></li>
<li><a href="http://meyerweb.com/eric/tests/ie-reserved-item.html">IE Keyword Testing (item)</a></li>
<li><a href="http://meyerweb.com/eric/tests/ie-reserved-nameditem.html">IE Keyword Testing (namedItem)</a></li>
<li><a href="http://meyerweb.com/eric/tests/ie-reserved-tags.html">IE Keyword Testing (tags)</a></li>
<li><a href="http://meyerweb.com/eric/tests/ie-reserved-urns.html">IE Keyword Testing (urns)</a></li>
</ul>

<p>
These are based on <a href="http://meyerweb.com/eric/thoughts/2005/08/26/when-printing-kills/#comment-6225">Kevin Hamilton&#8217;s observation</a> that it&#8217;s highly likely the problems are caused by the <code>tags</code> method in IE/Win&#8217;s <code>document.all</code> DOM interface.  As he says:
</p>
<blockquote>
<p>
[I]f you have an element with an id=&#8221;tags&#8221;, then document.all.tags is now a reference to that element, and no longer a method of the document.all object.
</p>
</blockquote>
<p>
Such states would completely shatter any IE DOM scripting that relied on the <code>document.all</code> methods, and at least in the case of <code>tags</code> causes problems like crashing on print (probably because of the aforementioned conflict between the ID value and the DOM method).  The other keywords of concern are chronicled in the test pages listed above.  I&#8217;d test IE/Win myself, except I don&#8217;t have a printer handy for IE/Win to use, and besides, bug-hunting is best conducted in large groups.
</p>
<p>
Basically, load up each test page in IE/Win and do anything you can think to do.  Try to print, view source, save a local copy, et cetera, et cetera&#8212;the more obscure and offbeat, the better.  Let us know via the comments any problems you run into with said pages (trying to print them is a good first step, since that&#8217;s what messed up on <code>tags</code>) and I&#8217;ll add notes to each page based on what&#8217;s found.
</p>
<p>
In the meantime, I&#8217;m personally going to avoid using any of those words as ID values, and heartily recommend the same to you.
</p>
<p>
<strong>Update:</strong> I&#8217;ve added <a href="http://meyerweb.com/eric/tests/ie-reserved-length.html">a test (for <code>length</code>)</a> to the above list, and have another that&#8217;s not on the list due to its unfinished nature.  It&#8217;s <a href="http://meyerweb.com/eric/tests/ie-reserved-all.html">a test of <code>id="all"</code></a>; the problem is, I don&#8217;t really know how to test it, or if it&#8217;s likely to be a problem at all.  Suggestions are welcomed in the comments.  I added some JavaScript links to some of the test pages as a secondary test, but I&#8217;m not sure how much good they do, to be honest.  As with suggestions, your feedback is welcome.
</p>
<p>
For those in search of more background, or trying to find new ways to test possible conflicts, or whatever, feel free to look over Microsoft&#8217;s <a href="http://msdn.microsoft.com/workshop/author/dhtml/reference/collections/all.asp">documentation of the &#8220;all Collection&#8221;</a>.
</p>]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2005/08/29/reserved-id-values/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>When Printing Kills</title>
		<link>http://meyerweb.com/eric/thoughts/2005/08/26/when-printing-kills/</link>
		<comments>http://meyerweb.com/eric/thoughts/2005/08/26/when-printing-kills/#comments</comments>
		<pubDate>Sat, 27 Aug 2005 01:32:33 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[DOM]]></category>

		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2005/08/26/when-printing-kills/</guid>
		<description><![CDATA[Use the wrong ID value, crash a browser.]]></description>
			<content:encoded><![CDATA[<p>
Here&#8217;s a fascinating little tidbit: on some users&#8217; machines, attempts to print out <a href="http://joeclark.org/" rel="acquaintance met">Joe Clark</a>&#8216;s <a href="http://alistapart.com/">ALA</a> article &#8220;<a href="http://alistapart.com/articles/pdf_accessibility">Facts and Opinions About PDF Accessibility</a>&#8221; would crash Internet Explorer.  The error message mentioned a script error in line 1401: &#8220;Object doesn&#8217;t support this property or method&#8221;.  Funny thing: we weren&#8217;t doing any scripting.  The error was actually occurring <code>shdoclc.dll/preview.dlg</code>, which is of course a piece of the operating system.
</p>
<p>
<a href="http://jasonsantamaria.com/" rel="co-worker acquaintance colleague met">Jason</a> did some sleuthing and traced the crash to this line of markup:
</p>
<pre>
&lt;h2 id="tags"&gt;Tags and structure&lt;/h2&gt;
</pre>
<p>
Honestly, that was it.  So <a href="http://zeldman.com/" rel="frind colleague met">Jeffrey</a> renamed the ID to read:
</p>
<pre>
&lt;h2 id="structure"&gt;Tags and structure&lt;/h2&gt;
</pre>
<p>
So far as we know, no more crashing in Explorer.
</p>
<p>
Ain&#8217;t browsers a <em>slice</em>?
</p>
<p>
(And yes, we&#8217;re aware of the clamor for a print style sheet.  More on this later.)
</p>
<p>
<strong>Update:</strong> Marten Veldthuis from <a href="http://strongspace.com/">Strongpsace</a> points out that <a href="http://37signals.com/">37signals</a> ran into a very similar problem in <a href="http://www.backpackit.com/">Backpack</a>.  Details can be found in <a href="http://jamis.jamisbuck.org/">Jamis Buck</a>&#8216;s June 3rd post <a href="http://jamis.jamisbuck.org/articles/2005/06/03/ie-is-teh-3v1l">ie-is-teh-3v1l</a>.  <strong>Spread the word:</strong> &#8220;tags&#8221; is effectively a reserved keyword, even though no such concept exists in (X)HTML.  Use it at your (users&#8217;) peril.
</p>]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2005/08/26/when-printing-kills/feed/</wfw:commentRss>
		<slash:comments>46</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
