So there I was, minding my own business, casually browsing MSDN for no reason, when I came across the UNSELECTABLE attribute. This attribute, as MSDN cheerfully points out, "specifies that an element cannot be selected." As in, text selection. With the mouse. Or, presumably, with the keyboard. Or, in case the author decides for you, not at all.
I will note in passing that you turn text selection off by setting the
unselectable attribute to on. But that's not the interesting part. This sentence caught my eye:
The UNSELECTABLE attribute is implemented as an expando. Setting the expando property of the document object to false precludes the functionality of all expandos.
"Precludes the functionality." Awesome.
Which led me to this wonderful example of using the expando property:
The following example demonstrates that, by setting the
expandoproperty of the document object to
false, the document ignores the UNSELECTABLE expando on the span and allows you to select the text.
But wait! What was that implementation note about the
unselectable attribute? "The UNSELECTABLE attribute is implemented as an expando." Hmm. "Is implemented as an expando" sounds like one of those boilerplate phrases, like "There is no public standard that applies to this..." Are there other wacky "expando" properties that can be neutralized by setting
document.expando? As it turns out, no. The UNSELECTABLE attribute is the only expando property that Internet Explorer recognizes, and therefore the only feature that can be disabled (or, depending how you look at it, re-enabled) by setting
To sum up, you can turn text selection off by setting the
unselectable attribute to on, and then you can turn text selection back on by setting the
document.expando property to false. No other functionality is affected, and it only works in Internet Explorer.
Here's an idea for an April Fool's joke: Microsoft apologizes for treating the web as their own private playground for 12 years, and offers all web developers a token refund and a free t-shirt. Feel free to post ideas for the t-shirt.