first_page

DOM Assertions

According to Google, the phrase “DOM Assertion” is not used in the manner it will be used here. Being unique does have its drawbacks—and surely my counting of them goes well beyond 99! Nevertheless, we do know about the XPath Assertion when we use an XPath query. This is to say, using an XPath query is often an assertion that you ‘expect’ an element or attribute to be present in an XML set. We do the same thing in JavaScript: var o = YAHOO.util.Dom.get('MyWidget') if(o) { //do stuff: }We can only ‘do stuff’ when the variable o is not null. So only when our assertion is correct can we do work.

rasx()