Difference of Getting DOM ElementsM Between IE6 & FF2
2008-07-04 21:27
399 查看
Considering the following piece of XSLT
<xsl:template match="/uo_content/attractions/ride"> ...</xsl:template>
How about if we want to get the "template" element from this document?
var template = doc.getElementByTagName("xsl:template")[0] // <--It does work, but only for IE
var template = doc.getElementByTagName("template")[0] // <-- Firefox only
var template = doc.getElementByTagName("xsl:template")[0] || doc.getElementByTagName("template")[0] //<-- Both
Consider that "xsl" is a namespace but not a part of the tag name, I think Firefox way is better.(Tested in IE6 and FF2)
<xsl:template match="/uo_content/attractions/ride"> ...</xsl:template>
How about if we want to get the "template" element from this document?
var template = doc.getElementByTagName("xsl:template")[0] // <--It does work, but only for IE
var template = doc.getElementByTagName("template")[0] // <-- Firefox only
var template = doc.getElementByTagName("xsl:template")[0] || doc.getElementByTagName("template")[0] //<-- Both
Consider that "xsl" is a namespace but not a part of the tag name, I think Firefox way is better.(Tested in IE6 and FF2)
相关文章推荐
- Difference of Getting DOM ElementsM Between IE6 & FF2
- What is the difference between SVD and matrix factorization in context of recommendation engine?
- What is the difference between DHTML and the DOM?
- [翻译]性别差异:对女性的误解(Differences between the sexes:The mismeasure of woman)
- Difference between the Bill of distribution and sourcing rule.
- The difference between equals and == of Java
- One of the difference between JDK1.6.0 and JDK1.7.0
- Difference between node and element in xml
- Python, difference between two ways for removing last elem of list
- Difference between forward and include of RequestDispatcher
- Difference between OnPaint and OnDraw of MFC
- BigDecimal(-)Difference of BigDecimal toString() method between JDK1.4 and above version
- one mail for difference between LOCAL_LDLIBS and LOCAL_SHARED_LIBRARIES of Android
- the differences of DataRelation class between 1.1 and 2.0
- Swap the elements of two sequences, such that the difference of the element-sums gets minimal.
- the differences of DataRelation class between 1.1 and 2.0
- The Difference Between Big Data and a Lot of Data
- what is difference between equals() and contentEquals() of String class?
- Difference between parseInt and valueOf in java?
- Getting the ID of the element that fired an event using jQuery