Skip to content

Instantly share code, notes, and snippets.

@chitoku-k
Last active October 20, 2018 17:19
Show Gist options
  • Save chitoku-k/2300b737027f146677bc82f2f1813493 to your computer and use it in GitHub Desktop.
Save chitoku-k/2300b737027f146677bc82f2f1813493 to your computer and use it in GitHub Desktop.
Who owns document.title?
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>タイトルです</title>
</head>
<body>
<form name="head"></form>
<form name="title"></form>
<form name="body"></form>
<form name="images"></form>
<form name="embeds"></form>
<form name="plugins"></form>
<form name="links"></form>
<form name="forms"></form>
<form name="scripts"></form>
<div id="result"></div>
<script>
HTMLFormElement.prototype.toString = function () {
return "要素です: " + this.name;
};
var items = [
"head",
"title",
"body",
"images",
"embeds",
"plugins",
"links",
"forms",
"scripts",
];
for (var i = 0; i < items.length; ++i) {
result.appendChild(document.createTextNode(document[items[i]]));
result.appendChild(document.createElement("br"));
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment