| 1 |
<!DOCTYPE html> |
| 2 |
<html lang="en"> |
| 3 |
<head> |
| 4 |
<title>Element.getAttribute ("xml:lang")</title> |
| 5 |
</head> |
| 6 |
<body> |
| 7 |
<h1><code><var>Element</var>.getAttribute ("xml:lang")</code></h1> |
| 8 |
|
| 9 |
<p>Does <code><var>Element</var>.getAttribute |
| 10 |
("xml:lang")</code> match to |
| 11 |
attribute <code>("http://www.w3.org/XML/1998/namespace", |
| 12 |
"xml", "lang")</code>?</p> |
| 13 |
|
| 14 |
<p>Result: <span id="result">NOT EXECUTED</span></p> |
| 15 |
|
| 16 |
<script> |
| 17 |
window.onload = function () { |
| 18 |
var result = document.getElementById ("result"); |
| 19 |
result.firstChild.data = "FAILED"; |
| 20 |
|
| 21 |
var el = document.createElement ("span"); |
| 22 |
el.setAttributeNS ("http://www.w3.org/XML/1998/namespace", |
| 23 |
"xml:lang", "MATCH"); |
| 24 |
|
| 25 |
var attr = el.getAttribute ("xml:lang"); |
| 26 |
|
| 27 |
if (attr == null) { |
| 28 |
result.firstChild.data = "NO MATCH (null)"; |
| 29 |
} else if (attr == "") { |
| 30 |
result.firstChild.data = "NO MATCH (empty)"; |
| 31 |
} else { |
| 32 |
result.firstChild.data = attr; |
| 33 |
} |
| 34 |
}; |
| 35 |
</script> |
| 36 |
|
| 37 |
</body> |
| 38 |
</html> |