Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Noscript comment example

  • Loading branch information...
commit 1c12589b8033712dd14e7b54a66652152b5c11c5 1 parent 3382bd2
@jakearchibald authored
View
28 experiments/comment-noscript.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <title>Getting the content of noscript elements</title>
+ <meta name="HandheldFriendly" content="True">
+ <meta name="MobileOptimized" content="320">
+ <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0">
+ <meta http-equiv="cleartype" content="on">
+</head>
+<body>
+ <script id="dirty">document.write('<' + '!--')</script><noscript>
+ <img src="http://farm4.staticflickr.com/3251/3037941702_295f176804_s.jpg" alt="A cat, asleep">
+ </noscript -->
+ <script>
+ window.onload = function() {
+ var script = document.getElementById('dirty'),
+ msg = "The content of the comment is: "
+ + script.nextSibling.nodeValue;
+
+ document.body.appendChild(
+ document.createTextNode(msg)
+ );
+ };
+ </script>
+</body>
+</html>
View
2  experiments/comment-parsing.html
@@ -16,7 +16,7 @@
<script>
window.onload = function() {
var script = document.getElementById('dirty'),
- msg = "The content of the comment is:"
+ msg = "The content of the comment is: "
+ script.nextSibling.nodeValue;
document.body.appendChild(
View
2  experiments/noscript-parsing.html
@@ -16,7 +16,7 @@
<script>
window.onload = function() {
var noscript = document.getElementsByTagName('noscript')[0],
- msg = "The content of the noscript element is:"
+ msg = "The content of the noscript element is: "
+ (noscript.textContent || noscript.innerText);
document.body.appendChild(
Please sign in to comment.
Something went wrong with that request. Please try again.