- From: Cameron McCormack <cam@mcc.id.au>
- Date: Mon, 22 Oct 2007 17:35:50 +1000
- To: public-html@w3.org
Thomas Broyer: > How would you test that it is available? > > <script>if ("getElementsByClassName" in document) { ... }</script> > or > <script>if (document.getElementsByClassName) { ... }</script> > work, but how would you test that createElement and/or createElementNS > can take an additional argument? If document.getElementsByClassName is an actual Function, you could test that document.getElementsByClassName.length == 2. > createElementWithTextContent could work, but then you'd also want a > createAttributeWithValue. > > I doubt though there would be a huge advantage over doing: > var link_to_add = document.createElement("a"); > link_to_add.textContent = the_text.nodeValue; Agreed. -- Cameron McCormack, http://mcc.id.au/ xmpp:heycam@jabber.org ▪ ICQ 26955922 ▪ MSN cam@mcc.id.au
Received on Monday, 22 October 2007 07:36:06 UTC