Created
December 28, 2010 16:37
-
-
Save think49/757398 to your computer and use it in GitHub Desktop.
Div.js: new Div で [object HTMLDivElement] を生成するコンストラクタ。new Image の真似。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Div.js | |
| * | |
| * @version 0.2 | |
| * @author think49 | |
| */ | |
| /** | |
| * DOM HTMLDivElement constructor. | |
| * @constructor | |
| * @returns "[object HTMLDivElement]" | |
| * @type Object | |
| */ | |
| function Div () { | |
| if (!(this instanceof Div)) { | |
| throw new TypeError('DOM object constructor cannot be called as a function.'); | |
| } | |
| return document.createElementNS('http://www.w3.org/1999/xhtml', 'div'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment