| 1 |
"use strict"; |
| 2 |
var Node = require('./Node'); |
| 3 |
var Element = require('./Element'); |
| 4 |
var CSSStyleDeclaration = require('./CSSStyleDeclaration'); |
| 5 |
var utils = require('./utils'); |
| 6 |
var URLUtils = require('./URLUtils'); |
| 7 |
var defineElement = require('./defineElement'); |
| 8 |
|
| 9 |
var htmlElements = exports.elements = {}; |
| 10 |
var htmlNameToImpl = Object.create(null); |
| 11 |
|
| 12 |
exports.createElement = function(doc, localName, prefix) { |
| 13 |
var impl = htmlNameToImpl[localName] || HTMLUnknownElement; |
| 14 |
return new impl(doc, localName, prefix); |
| 15 |
}; |
| 16 |
|
| 17 |
function define(spec) { |
| 18 |
return defineElement(spec, HTMLElement, htmlElements, htmlNameToImpl); |
| 19 |
} |
| 20 |
|
| 21 |
function URL(attr) { |
| 22 |
return { |
| 23 |
get: function() { |
| 24 |
var v = this._getattr(attr); |
| 25 |
if (v === null) { return ''; } |
| 26 |
var url = this.doc._resolve(v); |
| 27 |
return (url === null) ? v : url; |
| 28 |
}, |
| 29 |
set: function(value) { |
| 30 |
this._setattr(attr, value); |
| 31 |
} |
| 32 |
}; |
| 33 |
} |
| 34 |
|
| 35 |
function CORS(attr) { |
| 36 |
return { |
| 37 |
get: function() { |
| 38 |
var v = this._getattr(attr); |
| 39 |
if (v === null) { return null; } |
| 40 |
if (v.toLowerCase() === 'use-credentials') { return 'use-credentials'; } |
| 41 |
return 'anonymous'; |
| 42 |
}, |
| 43 |
set: function(value) { |
| 44 |
if (value===null || value===undefined) { |
| 45 |
this.removeAttribute(attr); |
| 46 |
} else { |
| 47 |
this._setattr(attr, value); |
| 48 |
} |
| 49 |
} |
| 50 |
}; |
| 51 |
} |
| 52 |
|
| 53 |
const REFERRER = { |
| 54 |
type: ["", "no-referrer", "no-referrer-when-downgrade", "same-origin", "origin", "strict-origin", "origin-when-cross-origin", "strict-origin-when-cross-origin", "unsafe-url"], |
| 55 |
missing: '', |
| 56 |
}; |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
var focusableElements = { |
| 64 |
"A":true, "LINK":true, "BUTTON":true, "INPUT":true, |
| 65 |
"SELECT":true, "TEXTAREA":true, "COMMAND":true |
| 66 |
}; |
| 67 |
|
| 68 |
var HTMLFormElement = function(doc, localName, prefix) { |
| 69 |
HTMLElement.call(this, doc, localName, prefix); |
| 70 |
this._form = null; |
| 71 |
}; |
| 72 |
|
| 73 |
var HTMLElement = exports.HTMLElement = define({ |
| 74 |
superclass: Element, |
| 75 |
name: 'HTMLElement', |
| 76 |
ctor: function HTMLElement(doc, localName, prefix) { |
| 77 |
Element.call(this, doc, localName, utils.NAMESPACE.HTML, prefix); |
| 78 |
}, |
| 79 |
props: { |
| 80 |
dangerouslySetInnerHTML: { |
| 81 |
set: function (v) { |
| 82 |
this._innerHTML = v; |
| 83 |
}, |
| 84 |
}, |
| 85 |
innerHTML: { |
| 86 |
get: function() { |
| 87 |
return this.serialize(); |
| 88 |
}, |
| 89 |
set: function(v) { |
| 90 |
var parser = this.ownerDocument.implementation.mozHTMLParser( |
| 91 |
this.ownerDocument._address, |
| 92 |
this); |
| 93 |
parser.parse(v===null ? '' : String(v), true); |
| 94 |
|
| 95 |
|
| 96 |
var target = (this instanceof htmlNameToImpl.template) ? |
| 97 |
this.content : this; |
| 98 |
while(target.hasChildNodes()) |
| 99 |
target.removeChild(target.firstChild); |
| 100 |
|
| 101 |
|
| 102 |
target.appendChild(parser._asDocumentFragment()); |
| 103 |
} |
| 104 |
}, |
| 105 |
style: { get: function() { |
| 106 |
if (!this._style) |
| 107 |
this._style = new CSSStyleDeclaration(this); |
| 108 |
return this._style; |
| 109 |
}, set: function(v) { |
| 110 |
if (v===null||v===undefined) { v = ''; } |
| 111 |
this._setattr('style', String(v)); |
| 112 |
}}, |
| 113 |
|
| 114 |
|
| 115 |
blur: { value: function() {}}, |
| 116 |
focus: { value: function() {}}, |
| 117 |
forceSpellCheck: { value: function() {}}, |
| 118 |
|
| 119 |
click: { value: function() { |
| 120 |
if (this._click_in_progress) return; |
| 121 |
this._click_in_progress = true; |
| 122 |
try { |
| 123 |
if (this._pre_click_activation_steps) |
| 124 |
this._pre_click_activation_steps(); |
| 125 |
|
| 126 |
var event = this.ownerDocument.createEvent("MouseEvent"); |
| 127 |
event.initMouseEvent("click", true, true, |
| 128 |
this.ownerDocument.defaultView, 1, |
| 129 |
0, 0, 0, 0, |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
false, false, false, false, |
| 134 |
0, null |
| 135 |
); |
| 136 |
|
| 137 |
|
| 138 |
var success = this.dispatchEvent(event); |
| 139 |
|
| 140 |
if (success) { |
| 141 |
if (this._post_click_activation_steps) |
| 142 |
this._post_click_activation_steps(event); |
| 143 |
} |
| 144 |
else { |
| 145 |
if (this._cancelled_activation_steps) |
| 146 |
this._cancelled_activation_steps(); |
| 147 |
} |
| 148 |
} |
| 149 |
finally { |
| 150 |
this._click_in_progress = false; |
| 151 |
} |
| 152 |
}}, |
| 153 |
submit: { value: utils.nyi }, |
| 154 |
}, |
| 155 |
attributes: { |
| 156 |
title: String, |
| 157 |
lang: String, |
| 158 |
dir: {type: ["ltr", "rtl", "auto"], missing: ''}, |
| 159 |
draggable: {type: ["true", "false"], treatNullAsEmptyString: true }, |
| 160 |
spellcheck: {type: ["true", "false"], missing: ''}, |
| 161 |
enterKeyHint: {type: ["enter", "done", "go", "next", "previous", "search", "send"], missing: ''}, |
| 162 |
autoCapitalize: {type: ["off", "on", "none", "sentences", "words", "characters"], missing: '' }, |
| 163 |
autoFocus: Boolean, |
| 164 |
accessKey: String, |
| 165 |
nonce: String, |
| 166 |
hidden: Boolean, |
| 167 |
translate: {type: ["no", "yes"], missing: '' }, |
| 168 |
tabIndex: {type: "long", default: function() { |
| 169 |
if (this.tagName in focusableElements || |
| 170 |
this.contentEditable) |
| 171 |
return 0; |
| 172 |
else |
| 173 |
return -1; |
| 174 |
}} |
| 175 |
}, |
| 176 |
events: [ |
| 177 |
"abort", "canplay", "canplaythrough", "change", "click", "contextmenu", |
| 178 |
"cuechange", "dblclick", "drag", "dragend", "dragenter", "dragleave", |
| 179 |
"dragover", "dragstart", "drop", "durationchange", "emptied", "ended", |
| 180 |
"input", "invalid", "keydown", "keypress", "keyup", "loadeddata", |
| 181 |
"loadedmetadata", "loadstart", "mousedown", "mousemove", "mouseout", |
| 182 |
"mouseover", "mouseup", "mousewheel", "pause", "play", "playing", |
| 183 |
"progress", "ratechange", "readystatechange", "reset", "seeked", |
| 184 |
"seeking", "select", "show", "stalled", "submit", "suspend", |
| 185 |
"timeupdate", "volumechange", "waiting", |
| 186 |
|
| 187 |
|
| 188 |
"blur", "error", "focus", "load", "scroll" |
| 189 |
] |
| 190 |
}); |
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
var HTMLUnknownElement = define({ |
| 218 |
name: 'HTMLUnknownElement', |
| 219 |
ctor: function HTMLUnknownElement(doc, localName, prefix) { |
| 220 |
HTMLElement.call(this, doc, localName, prefix); |
| 221 |
} |
| 222 |
}); |
| 223 |
|
| 224 |
|
| 225 |
var formAssociatedProps = { |
| 226 |
|
| 227 |
form: { get: function() { |
| 228 |
return this._form; |
| 229 |
}} |
| 230 |
}; |
| 231 |
|
| 232 |
define({ |
| 233 |
tag: 'a', |
| 234 |
name: 'HTMLAnchorElement', |
| 235 |
ctor: function HTMLAnchorElement(doc, localName, prefix) { |
| 236 |
HTMLElement.call(this, doc, localName, prefix); |
| 237 |
}, |
| 238 |
props: { |
| 239 |
_post_click_activation_steps: { value: function(e) { |
| 240 |
if (this.href) { |
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
this.ownerDocument.defaultView.location = this.href; |
| 245 |
} |
| 246 |
}}, |
| 247 |
}, |
| 248 |
attributes: { |
| 249 |
href: URL, |
| 250 |
ping: String, |
| 251 |
download: String, |
| 252 |
target: String, |
| 253 |
rel: String, |
| 254 |
media: String, |
| 255 |
hreflang: String, |
| 256 |
type: String, |
| 257 |
referrerPolicy: REFERRER, |
| 258 |
|
| 259 |
coords: String, |
| 260 |
charset: String, |
| 261 |
name: String, |
| 262 |
rev: String, |
| 263 |
shape: String, |
| 264 |
} |
| 265 |
}); |
| 266 |
|
| 267 |
URLUtils._inherit(htmlNameToImpl.a.prototype); |
| 268 |
|
| 269 |
define({ |
| 270 |
tag: 'area', |
| 271 |
name: 'HTMLAreaElement', |
| 272 |
ctor: function HTMLAreaElement(doc, localName, prefix) { |
| 273 |
HTMLElement.call(this, doc, localName, prefix); |
| 274 |
}, |
| 275 |
attributes: { |
| 276 |
alt: String, |
| 277 |
target: String, |
| 278 |
download: String, |
| 279 |
rel: String, |
| 280 |
media: String, |
| 281 |
href: URL, |
| 282 |
hreflang: String, |
| 283 |
type: String, |
| 284 |
shape: String, |
| 285 |
coords: String, |
| 286 |
ping: String, |
| 287 |
|
| 288 |
referrerPolicy: REFERRER, |
| 289 |
|
| 290 |
noHref: Boolean, |
| 291 |
} |
| 292 |
}); |
| 293 |
|
| 294 |
URLUtils._inherit(htmlNameToImpl.area.prototype); |
| 295 |
|
| 296 |
define({ |
| 297 |
tag: 'br', |
| 298 |
name: 'HTMLBRElement', |
| 299 |
ctor: function HTMLBRElement(doc, localName, prefix) { |
| 300 |
HTMLElement.call(this, doc, localName, prefix); |
| 301 |
}, |
| 302 |
attributes: { |
| 303 |
|
| 304 |
clear: String |
| 305 |
}, |
| 306 |
}); |
| 307 |
|
| 308 |
define({ |
| 309 |
tag: 'base', |
| 310 |
name: 'HTMLBaseElement', |
| 311 |
ctor: function HTMLBaseElement(doc, localName, prefix) { |
| 312 |
HTMLElement.call(this, doc, localName, prefix); |
| 313 |
}, |
| 314 |
attributes: { |
| 315 |
"target": String |
| 316 |
} |
| 317 |
}); |
| 318 |
|
| 319 |
|
| 320 |
define({ |
| 321 |
tag: 'body', |
| 322 |
name: 'HTMLBodyElement', |
| 323 |
ctor: function HTMLBodyElement(doc, localName, prefix) { |
| 324 |
HTMLElement.call(this, doc, localName, prefix); |
| 325 |
}, |
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
events: [ |
| 335 |
"afterprint", "beforeprint", "beforeunload", "blur", "error", |
| 336 |
"focus","hashchange", "load", "message", "offline", "online", |
| 337 |
"pagehide", "pageshow","popstate","resize","scroll","storage","unload", |
| 338 |
], |
| 339 |
attributes: { |
| 340 |
|
| 341 |
text: { type: String, treatNullAsEmptyString: true }, |
| 342 |
link: { type: String, treatNullAsEmptyString: true }, |
| 343 |
vLink: { type: String, treatNullAsEmptyString: true }, |
| 344 |
aLink: { type: String, treatNullAsEmptyString: true }, |
| 345 |
bgColor: { type: String, treatNullAsEmptyString: true }, |
| 346 |
background: String, |
| 347 |
} |
| 348 |
}); |
| 349 |
|
| 350 |
define({ |
| 351 |
tag: 'button', |
| 352 |
name: 'HTMLButtonElement', |
| 353 |
ctor: function HTMLButtonElement(doc, localName, prefix) { |
| 354 |
HTMLFormElement.call(this, doc, localName, prefix); |
| 355 |
}, |
| 356 |
props: formAssociatedProps, |
| 357 |
attributes: { |
| 358 |
name: String, |
| 359 |
value: String, |
| 360 |
disabled: Boolean, |
| 361 |
autofocus: Boolean, |
| 362 |
type: { type:["submit", "reset", "button", "menu"], missing: 'submit' }, |
| 363 |
formTarget: String, |
| 364 |
formAction: URL, |
| 365 |
formNoValidate: Boolean, |
| 366 |
formMethod: { type: ["get", "post", "dialog"], invalid: 'get', missing: '' }, |
| 367 |
formEnctype: { type: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalid: "application/x-www-form-urlencoded", missing: '' }, |
| 368 |
} |
| 369 |
}); |
| 370 |
|
| 371 |
define({ |
| 372 |
tag: 'dl', |
| 373 |
name: 'HTMLDListElement', |
| 374 |
ctor: function HTMLDListElement(doc, localName, prefix) { |
| 375 |
HTMLElement.call(this, doc, localName, prefix); |
| 376 |
}, |
| 377 |
attributes: { |
| 378 |
|
| 379 |
compact: Boolean, |
| 380 |
} |
| 381 |
}); |
| 382 |
|
| 383 |
define({ |
| 384 |
tag: 'data', |
| 385 |
name: 'HTMLDataElement', |
| 386 |
ctor: function HTMLDataElement(doc, localName, prefix) { |
| 387 |
HTMLElement.call(this, doc, localName, prefix); |
| 388 |
}, |
| 389 |
attributes: { |
| 390 |
value: String, |
| 391 |
} |
| 392 |
}); |
| 393 |
|
| 394 |
define({ |
| 395 |
tag: 'datalist', |
| 396 |
name: 'HTMLDataListElement', |
| 397 |
ctor: function HTMLDataListElement(doc, localName, prefix) { |
| 398 |
HTMLElement.call(this, doc, localName, prefix); |
| 399 |
} |
| 400 |
}); |
| 401 |
|
| 402 |
define({ |
| 403 |
tag: 'details', |
| 404 |
name: 'HTMLDetailsElement', |
| 405 |
ctor: function HTMLDetailsElement(doc, localName, prefix) { |
| 406 |
HTMLElement.call(this, doc, localName, prefix); |
| 407 |
}, |
| 408 |
attributes: { |
| 409 |
"open": Boolean |
| 410 |
} |
| 411 |
}); |
| 412 |
|
| 413 |
define({ |
| 414 |
tag: 'div', |
| 415 |
name: 'HTMLDivElement', |
| 416 |
ctor: function HTMLDivElement(doc, localName, prefix) { |
| 417 |
HTMLElement.call(this, doc, localName, prefix); |
| 418 |
}, |
| 419 |
attributes: { |
| 420 |
|
| 421 |
align: String |
| 422 |
} |
| 423 |
}); |
| 424 |
|
| 425 |
define({ |
| 426 |
tag: 'embed', |
| 427 |
name: 'HTMLEmbedElement', |
| 428 |
ctor: function HTMLEmbedElement(doc, localName, prefix) { |
| 429 |
HTMLElement.call(this, doc, localName, prefix); |
| 430 |
}, |
| 431 |
attributes: { |
| 432 |
src: URL, |
| 433 |
type: String, |
| 434 |
width: String, |
| 435 |
height: String, |
| 436 |
|
| 437 |
align: String, |
| 438 |
name: String, |
| 439 |
} |
| 440 |
}); |
| 441 |
|
| 442 |
define({ |
| 443 |
tag: 'fieldset', |
| 444 |
name: 'HTMLFieldSetElement', |
| 445 |
ctor: function HTMLFieldSetElement(doc, localName, prefix) { |
| 446 |
HTMLFormElement.call(this, doc, localName, prefix); |
| 447 |
}, |
| 448 |
props: formAssociatedProps, |
| 449 |
attributes: { |
| 450 |
disabled: Boolean, |
| 451 |
name: String |
| 452 |
} |
| 453 |
}); |
| 454 |
|
| 455 |
define({ |
| 456 |
tag: 'form', |
| 457 |
name: 'HTMLFormElement', |
| 458 |
ctor: function HTMLFormElement(doc, localName, prefix) { |
| 459 |
HTMLElement.call(this, doc, localName, prefix); |
| 460 |
}, |
| 461 |
attributes: { |
| 462 |
action: String, |
| 463 |
autocomplete: {type:['on', 'off'], missing: 'on'}, |
| 464 |
name: String, |
| 465 |
acceptCharset: {name: "accept-charset"}, |
| 466 |
target: String, |
| 467 |
noValidate: Boolean, |
| 468 |
method: { type: ["get", "post", "dialog"], invalid: 'get', missing: 'get' }, |
| 469 |
|
| 470 |
enctype: { type: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalid: "application/x-www-form-urlencoded", missing: "application/x-www-form-urlencoded" }, |
| 471 |
encoding: {name: 'enctype', type: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalid: "application/x-www-form-urlencoded", missing: "application/x-www-form-urlencoded" }, |
| 472 |
} |
| 473 |
}); |
| 474 |
|
| 475 |
define({ |
| 476 |
tag: 'hr', |
| 477 |
name: 'HTMLHRElement', |
| 478 |
ctor: function HTMLHRElement(doc, localName, prefix) { |
| 479 |
HTMLElement.call(this, doc, localName, prefix); |
| 480 |
}, |
| 481 |
attributes: { |
| 482 |
|
| 483 |
align: String, |
| 484 |
color: String, |
| 485 |
noShade: Boolean, |
| 486 |
size: String, |
| 487 |
width: String, |
| 488 |
}, |
| 489 |
}); |
| 490 |
|
| 491 |
define({ |
| 492 |
tag: 'head', |
| 493 |
name: 'HTMLHeadElement', |
| 494 |
ctor: function HTMLHeadElement(doc, localName, prefix) { |
| 495 |
HTMLElement.call(this, doc, localName, prefix); |
| 496 |
} |
| 497 |
}); |
| 498 |
|
| 499 |
define({ |
| 500 |
tags: ['h1','h2','h3','h4','h5','h6'], |
| 501 |
name: 'HTMLHeadingElement', |
| 502 |
ctor: function HTMLHeadingElement(doc, localName, prefix) { |
| 503 |
HTMLElement.call(this, doc, localName, prefix); |
| 504 |
}, |
| 505 |
attributes: { |
| 506 |
|
| 507 |
align: String, |
| 508 |
}, |
| 509 |
}); |
| 510 |
|
| 511 |
define({ |
| 512 |
tag: 'html', |
| 513 |
name: 'HTMLHtmlElement', |
| 514 |
ctor: function HTMLHtmlElement(doc, localName, prefix) { |
| 515 |
HTMLElement.call(this, doc, localName, prefix); |
| 516 |
}, |
| 517 |
attributes: { |
| 518 |
xmlns: URL, |
| 519 |
|
| 520 |
version: String |
| 521 |
} |
| 522 |
}); |
| 523 |
|
| 524 |
define({ |
| 525 |
tag: 'iframe', |
| 526 |
name: 'HTMLIFrameElement', |
| 527 |
ctor: function HTMLIFrameElement(doc, localName, prefix) { |
| 528 |
HTMLElement.call(this, doc, localName, prefix); |
| 529 |
}, |
| 530 |
attributes: { |
| 531 |
src: URL, |
| 532 |
srcdoc: String, |
| 533 |
name: String, |
| 534 |
width: String, |
| 535 |
height: String, |
| 536 |
|
| 537 |
seamless: Boolean, |
| 538 |
allow: Boolean, |
| 539 |
allowFullscreen: Boolean, |
| 540 |
allowUserMedia: Boolean, |
| 541 |
allowPaymentRequest: Boolean, |
| 542 |
referrerPolicy: REFERRER, |
| 543 |
loading: { type:['eager','lazy'], treatNullAsEmptyString: true }, |
| 544 |
|
| 545 |
align: String, |
| 546 |
scrolling: String, |
| 547 |
frameBorder: String, |
| 548 |
longDesc: URL, |
| 549 |
marginHeight: { type: String, treatNullAsEmptyString: true }, |
| 550 |
marginWidth: { type: String, treatNullAsEmptyString: true }, |
| 551 |
} |
| 552 |
}); |
| 553 |
|
| 554 |
define({ |
| 555 |
tag: 'img', |
| 556 |
name: 'HTMLImageElement', |
| 557 |
ctor: function HTMLImageElement(doc, localName, prefix) { |
| 558 |
HTMLElement.call(this, doc, localName, prefix); |
| 559 |
}, |
| 560 |
attributes: { |
| 561 |
alt: String, |
| 562 |
src: URL, |
| 563 |
srcset: String, |
| 564 |
crossOrigin: CORS, |
| 565 |
useMap: String, |
| 566 |
isMap: Boolean, |
| 567 |
sizes: String, |
| 568 |
height: { type: "unsigned long", default: 0 }, |
| 569 |
width: { type: "unsigned long", default: 0 }, |
| 570 |
referrerPolicy: REFERRER, |
| 571 |
loading: { type:['eager','lazy'], missing: '' }, |
| 572 |
|
| 573 |
name: String, |
| 574 |
lowsrc: URL, |
| 575 |
align: String, |
| 576 |
hspace: { type: "unsigned long", default: 0 }, |
| 577 |
vspace: { type: "unsigned long", default: 0 }, |
| 578 |
longDesc: URL, |
| 579 |
border: { type: String, treatNullAsEmptyString: true }, |
| 580 |
} |
| 581 |
}); |
| 582 |
|
| 583 |
define({ |
| 584 |
tag: 'input', |
| 585 |
name: 'HTMLInputElement', |
| 586 |
ctor: function HTMLInputElement(doc, localName, prefix) { |
| 587 |
HTMLFormElement.call(this, doc, localName, prefix); |
| 588 |
}, |
| 589 |
props: { |
| 590 |
form: formAssociatedProps.form, |
| 591 |
_post_click_activation_steps: { value: function(e) { |
| 592 |
if (this.type === 'checkbox') { |
| 593 |
this.checked = !this.checked; |
| 594 |
} |
| 595 |
else if (this.type === 'radio') { |
| 596 |
var group = this.form.getElementsByName(this.name); |
| 597 |
for (var i=group.length-1; i >= 0; i--) { |
| 598 |
var el = group[i]; |
| 599 |
el.checked = (el === this); |
| 600 |
} |
| 601 |
} |
| 602 |
}}, |
| 603 |
}, |
| 604 |
attributes: { |
| 605 |
name: String, |
| 606 |
disabled: Boolean, |
| 607 |
autofocus: Boolean, |
| 608 |
accept: String, |
| 609 |
alt: String, |
| 610 |
max: String, |
| 611 |
min: String, |
| 612 |
pattern: String, |
| 613 |
placeholder: String, |
| 614 |
step: String, |
| 615 |
dirName: String, |
| 616 |
defaultValue: {name: 'value'}, |
| 617 |
multiple: Boolean, |
| 618 |
required: Boolean, |
| 619 |
readOnly: Boolean, |
| 620 |
checked: Boolean, |
| 621 |
value: String, |
| 622 |
src: URL, |
| 623 |
defaultChecked: {name: 'checked', type: Boolean}, |
| 624 |
size: {type: 'unsigned long', default: 20, min: 1, setmin: 1}, |
| 625 |
width: {type: 'unsigned long', min: 0, setmin: 0, default: 0}, |
| 626 |
height: {type: 'unsigned long', min: 0, setmin: 0, default: 0}, |
| 627 |
minLength: {type: 'unsigned long', min: 0, setmin: 0, default: -1}, |
| 628 |
maxLength: {type: 'unsigned long', min: 0, setmin: 0, default: -1}, |
| 629 |
autocomplete: String, |
| 630 |
type: { type: |
| 631 |
["text", "hidden", "search", "tel", "url", "email", "password", |
| 632 |
"datetime", "date", "month", "week", "time", "datetime-local", |
| 633 |
"number", "range", "color", "checkbox", "radio", "file", "submit", |
| 634 |
"image", "reset", "button"], |
| 635 |
missing: 'text' }, |
| 636 |
formTarget: String, |
| 637 |
formNoValidate: Boolean, |
| 638 |
formMethod: { type: ["get", "post"], invalid: 'get', missing: '' }, |
| 639 |
formEnctype: { type: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalid: "application/x-www-form-urlencoded", missing: '' }, |
| 640 |
inputMode: { type: [ "verbatim", "latin", "latin-name", "latin-prose", "full-width-latin", "kana", "kana-name", "katakana", "numeric", "tel", "email", "url" ], missing: '' }, |
| 641 |
|
| 642 |
align: String, |
| 643 |
useMap: String, |
| 644 |
} |
| 645 |
}); |
| 646 |
|
| 647 |
define({ |
| 648 |
tag: 'keygen', |
| 649 |
name: 'HTMLKeygenElement', |
| 650 |
ctor: function HTMLKeygenElement(doc, localName, prefix) { |
| 651 |
HTMLFormElement.call(this, doc, localName, prefix); |
| 652 |
}, |
| 653 |
props: formAssociatedProps, |
| 654 |
attributes: { |
| 655 |
name: String, |
| 656 |
disabled: Boolean, |
| 657 |
autofocus: Boolean, |
| 658 |
challenge: String, |
| 659 |
keytype: { type:["rsa"], missing: '' }, |
| 660 |
} |
| 661 |
}); |
| 662 |
|
| 663 |
define({ |
| 664 |
tag: 'li', |
| 665 |
name: 'HTMLLIElement', |
| 666 |
ctor: function HTMLLIElement(doc, localName, prefix) { |
| 667 |
HTMLElement.call(this, doc, localName, prefix); |
| 668 |
}, |
| 669 |
attributes: { |
| 670 |
value: {type: "long", default: 0}, |
| 671 |
|
| 672 |
type: String, |
| 673 |
} |
| 674 |
}); |
| 675 |
|
| 676 |
define({ |
| 677 |
tag: 'label', |
| 678 |
name: 'HTMLLabelElement', |
| 679 |
ctor: function HTMLLabelElement(doc, localName, prefix) { |
| 680 |
HTMLFormElement.call(this, doc, localName, prefix); |
| 681 |
}, |
| 682 |
props: formAssociatedProps, |
| 683 |
attributes: { |
| 684 |
htmlFor: {name: 'for', type: String} |
| 685 |
} |
| 686 |
}); |
| 687 |
|
| 688 |
define({ |
| 689 |
tag: 'legend', |
| 690 |
name: 'HTMLLegendElement', |
| 691 |
ctor: function HTMLLegendElement(doc, localName, prefix) { |
| 692 |
HTMLElement.call(this, doc, localName, prefix); |
| 693 |
}, |
| 694 |
attributes: { |
| 695 |
|
| 696 |
align: String |
| 697 |
}, |
| 698 |
}); |
| 699 |
|
| 700 |
define({ |
| 701 |
tag: 'link', |
| 702 |
name: 'HTMLLinkElement', |
| 703 |
ctor: function HTMLLinkElement(doc, localName, prefix) { |
| 704 |
HTMLElement.call(this, doc, localName, prefix); |
| 705 |
}, |
| 706 |
attributes: { |
| 707 |
|
| 708 |
href: URL, |
| 709 |
rel: String, |
| 710 |
media: String, |
| 711 |
hreflang: String, |
| 712 |
type: String, |
| 713 |
crossOrigin: CORS, |
| 714 |
nonce: String, |
| 715 |
integrity: String, |
| 716 |
referrerPolicy: REFERRER, |
| 717 |
imageSizes: String, |
| 718 |
imageSrcset: String, |
| 719 |
|
| 720 |
charset: String, |
| 721 |
rev: String, |
| 722 |
target: String, |
| 723 |
} |
| 724 |
}); |
| 725 |
|
| 726 |
define({ |
| 727 |
tag: 'map', |
| 728 |
name: 'HTMLMapElement', |
| 729 |
ctor: function HTMLMapElement(doc, localName, prefix) { |
| 730 |
HTMLElement.call(this, doc, localName, prefix); |
| 731 |
}, |
| 732 |
attributes: { |
| 733 |
name: String |
| 734 |
} |
| 735 |
}); |
| 736 |
|
| 737 |
define({ |
| 738 |
tag: 'menu', |
| 739 |
name: 'HTMLMenuElement', |
| 740 |
ctor: function HTMLMenuElement(doc, localName, prefix) { |
| 741 |
HTMLElement.call(this, doc, localName, prefix); |
| 742 |
}, |
| 743 |
attributes: { |
| 744 |
|
| 745 |
|
| 746 |
type: { type: [ 'context', 'popup', 'toolbar' ], missing: 'toolbar' }, |
| 747 |
label: String, |
| 748 |
|
| 749 |
compact: Boolean, |
| 750 |
} |
| 751 |
}); |
| 752 |
|
| 753 |
define({ |
| 754 |
tag: 'meta', |
| 755 |
name: 'HTMLMetaElement', |
| 756 |
ctor: function HTMLMetaElement(doc, localName, prefix) { |
| 757 |
HTMLElement.call(this, doc, localName, prefix); |
| 758 |
}, |
| 759 |
attributes: { |
| 760 |
name: String, |
| 761 |
content: String, |
| 762 |
httpEquiv: {name: 'http-equiv', type: String}, |
| 763 |
|
| 764 |
scheme: String, |
| 765 |
} |
| 766 |
}); |
| 767 |
|
| 768 |
define({ |
| 769 |
tag: 'meter', |
| 770 |
name: 'HTMLMeterElement', |
| 771 |
ctor: function HTMLMeterElement(doc, localName, prefix) { |
| 772 |
HTMLFormElement.call(this, doc, localName, prefix); |
| 773 |
}, |
| 774 |
props: formAssociatedProps |
| 775 |
}); |
| 776 |
|
| 777 |
define({ |
| 778 |
tags: ['ins', 'del'], |
| 779 |
name: 'HTMLModElement', |
| 780 |
ctor: function HTMLModElement(doc, localName, prefix) { |
| 781 |
HTMLElement.call(this, doc, localName, prefix); |
| 782 |
}, |
| 783 |
attributes: { |
| 784 |
cite: URL, |
| 785 |
dateTime: String |
| 786 |
} |
| 787 |
}); |
| 788 |
|
| 789 |
define({ |
| 790 |
tag: 'ol', |
| 791 |
name: 'HTMLOListElement', |
| 792 |
ctor: function HTMLOListElement(doc, localName, prefix) { |
| 793 |
HTMLElement.call(this, doc, localName, prefix); |
| 794 |
}, |
| 795 |
props: { |
| 796 |
|
| 797 |
|
| 798 |
_numitems: { get: function() { |
| 799 |
var items = 0; |
| 800 |
this.childNodes.forEach(function(n) { |
| 801 |
if (n.nodeType === Node.ELEMENT_NODE && n.tagName === "LI") |
| 802 |
items++; |
| 803 |
}); |
| 804 |
return items; |
| 805 |
}} |
| 806 |
}, |
| 807 |
attributes: { |
| 808 |
type: String, |
| 809 |
reversed: Boolean, |
| 810 |
start: { |
| 811 |
type: "long", |
| 812 |
default: function() { |
| 813 |
|
| 814 |
|
| 815 |
if (this.reversed) |
| 816 |
return this._numitems; |
| 817 |
else |
| 818 |
return 1; |
| 819 |
} |
| 820 |
}, |
| 821 |
|
| 822 |
compact: Boolean, |
| 823 |
} |
| 824 |
}); |
| 825 |
|
| 826 |
define({ |
| 827 |
tag: 'object', |
| 828 |
name: 'HTMLObjectElement', |
| 829 |
ctor: function HTMLObjectElement(doc, localName, prefix) { |
| 830 |
HTMLFormElement.call(this, doc, localName, prefix); |
| 831 |
}, |
| 832 |
props: formAssociatedProps, |
| 833 |
attributes: { |
| 834 |
data: URL, |
| 835 |
type: String, |
| 836 |
name: String, |
| 837 |
useMap: String, |
| 838 |
typeMustMatch: Boolean, |
| 839 |
width: String, |
| 840 |
height: String, |
| 841 |
|
| 842 |
align: String, |
| 843 |
archive: String, |
| 844 |
code: String, |
| 845 |
declare: Boolean, |
| 846 |
hspace: { type: "unsigned long", default: 0 }, |
| 847 |
standby: String, |
| 848 |
vspace: { type: "unsigned long", default: 0 }, |
| 849 |
codeBase: URL, |
| 850 |
codeType: String, |
| 851 |
border: { type: String, treatNullAsEmptyString: true }, |
| 852 |
} |
| 853 |
}); |
| 854 |
|
| 855 |
define({ |
| 856 |
tag: 'optgroup', |
| 857 |
name: 'HTMLOptGroupElement', |
| 858 |
ctor: function HTMLOptGroupElement(doc, localName, prefix) { |
| 859 |
HTMLElement.call(this, doc, localName, prefix); |
| 860 |
}, |
| 861 |
attributes: { |
| 862 |
disabled: Boolean, |
| 863 |
label: String |
| 864 |
} |
| 865 |
}); |
| 866 |
|
| 867 |
define({ |
| 868 |
tag: 'option', |
| 869 |
name: 'HTMLOptionElement', |
| 870 |
ctor: function HTMLOptionElement(doc, localName, prefix) { |
| 871 |
HTMLElement.call(this, doc, localName, prefix); |
| 872 |
}, |
| 873 |
props: { |
| 874 |
form: { get: function() { |
| 875 |
var p = this.parentNode; |
| 876 |
while (p && p.nodeType === Node.ELEMENT_NODE) { |
| 877 |
if (p.localName === 'select') return p.form; |
| 878 |
p = p.parentNode; |
| 879 |
} |
| 880 |
}}, |
| 881 |
value: { |
| 882 |
get: function() { return this._getattr('value') || this.text; }, |
| 883 |
set: function(v) { this._setattr('value', v); }, |
| 884 |
}, |
| 885 |
text: { |
| 886 |
get: function() { |
| 887 |
|
| 888 |
return this.textContent.replace(/[ \t\n\f\r]+/g, ' ').trim(); |
| 889 |
}, |
| 890 |
set: function(v) { this.textContent = v; }, |
| 891 |
}, |
| 892 |
|
| 893 |
}, |
| 894 |
attributes: { |
| 895 |
disabled: Boolean, |
| 896 |
defaultSelected: {name: 'selected', type: Boolean}, |
| 897 |
label: String, |
| 898 |
} |
| 899 |
}); |
| 900 |
|
| 901 |
define({ |
| 902 |
tag: 'output', |
| 903 |
name: 'HTMLOutputElement', |
| 904 |
ctor: function HTMLOutputElement(doc, localName, prefix) { |
| 905 |
HTMLFormElement.call(this, doc, localName, prefix); |
| 906 |
}, |
| 907 |
props: formAssociatedProps, |
| 908 |
attributes: { |
| 909 |
|
| 910 |
name: String |
| 911 |
} |
| 912 |
}); |
| 913 |
|
| 914 |
define({ |
| 915 |
tag: 'p', |
| 916 |
name: 'HTMLParagraphElement', |
| 917 |
ctor: function HTMLParagraphElement(doc, localName, prefix) { |
| 918 |
HTMLElement.call(this, doc, localName, prefix); |
| 919 |
}, |
| 920 |
attributes: { |
| 921 |
|
| 922 |
align: String |
| 923 |
} |
| 924 |
}); |
| 925 |
|
| 926 |
define({ |
| 927 |
tag: 'param', |
| 928 |
name: 'HTMLParamElement', |
| 929 |
ctor: function HTMLParamElement(doc, localName, prefix) { |
| 930 |
HTMLElement.call(this, doc, localName, prefix); |
| 931 |
}, |
| 932 |
attributes: { |
| 933 |
name: String, |
| 934 |
value: String, |
| 935 |
|
| 936 |
type: String, |
| 937 |
valueType: String, |
| 938 |
} |
| 939 |
}); |
| 940 |
|
| 941 |
define({ |
| 942 |
tags: ['pre','listing','xmp'], |
| 943 |
name: 'HTMLPreElement', |
| 944 |
ctor: function HTMLPreElement(doc, localName, prefix) { |
| 945 |
HTMLElement.call(this, doc, localName, prefix); |
| 946 |
}, |
| 947 |
attributes: { |
| 948 |
|
| 949 |
width: { type: "long", default: 0 }, |
| 950 |
} |
| 951 |
}); |
| 952 |
|
| 953 |
define({ |
| 954 |
tag: 'progress', |
| 955 |
name: 'HTMLProgressElement', |
| 956 |
ctor: function HTMLProgressElement(doc, localName, prefix) { |
| 957 |
HTMLFormElement.call(this, doc, localName, prefix); |
| 958 |
}, |
| 959 |
props: formAssociatedProps, |
| 960 |
attributes: { |
| 961 |
max: {type: Number, float: true, default: 1.0, min: 0} |
| 962 |
} |
| 963 |
}); |
| 964 |
|
| 965 |
define({ |
| 966 |
tags: ['q', 'blockquote'], |
| 967 |
name: 'HTMLQuoteElement', |
| 968 |
ctor: function HTMLQuoteElement(doc, localName, prefix) { |
| 969 |
HTMLElement.call(this, doc, localName, prefix); |
| 970 |
}, |
| 971 |
attributes: { |
| 972 |
cite: URL |
| 973 |
} |
| 974 |
}); |
| 975 |
|
| 976 |
define({ |
| 977 |
tag: 'script', |
| 978 |
name: 'HTMLScriptElement', |
| 979 |
ctor: function HTMLScriptElement(doc, localName, prefix) { |
| 980 |
HTMLElement.call(this, doc, localName, prefix); |
| 981 |
}, |
| 982 |
props: { |
| 983 |
text: { |
| 984 |
get: function() { |
| 985 |
var s = ""; |
| 986 |
for(var i = 0, n = this.childNodes.length; i < n; i++) { |
| 987 |
var child = this.childNodes[i]; |
| 988 |
if (child.nodeType === Node.TEXT_NODE) |
| 989 |
s += child._data; |
| 990 |
} |
| 991 |
return s; |
| 992 |
}, |
| 993 |
set: function(value) { |
| 994 |
this.removeChildren(); |
| 995 |
if (value !== null && value !== "") { |
| 996 |
this.appendChild(this.ownerDocument.createTextNode(value)); |
| 997 |
} |
| 998 |
} |
| 999 |
} |
| 1000 |
}, |
| 1001 |
attributes: { |
| 1002 |
src: URL, |
| 1003 |
type: String, |
| 1004 |
charset: String, |
| 1005 |
referrerPolicy: REFERRER, |
| 1006 |
defer: Boolean, |
| 1007 |
async: Boolean, |
| 1008 |
nomodule: Boolean, |
| 1009 |
crossOrigin: CORS, |
| 1010 |
nonce: String, |
| 1011 |
integrity: String, |
| 1012 |
} |
| 1013 |
}); |
| 1014 |
|
| 1015 |
define({ |
| 1016 |
tag: 'select', |
| 1017 |
name: 'HTMLSelectElement', |
| 1018 |
ctor: function HTMLSelectElement(doc, localName, prefix) { |
| 1019 |
HTMLFormElement.call(this, doc, localName, prefix); |
| 1020 |
}, |
| 1021 |
props: { |
| 1022 |
form: formAssociatedProps.form, |
| 1023 |
options: { get: function() { |
| 1024 |
return this.getElementsByTagName('option'); |
| 1025 |
}} |
| 1026 |
}, |
| 1027 |
attributes: { |
| 1028 |
autocomplete: String, |
| 1029 |
name: String, |
| 1030 |
disabled: Boolean, |
| 1031 |
autofocus: Boolean, |
| 1032 |
multiple: Boolean, |
| 1033 |
required: Boolean, |
| 1034 |
size: {type: "unsigned long", default: 0} |
| 1035 |
} |
| 1036 |
}); |
| 1037 |
|
| 1038 |
define({ |
| 1039 |
tag: 'span', |
| 1040 |
name: 'HTMLSpanElement', |
| 1041 |
ctor: function HTMLSpanElement(doc, localName, prefix) { |
| 1042 |
HTMLElement.call(this, doc, localName, prefix); |
| 1043 |
} |
| 1044 |
}); |
| 1045 |
|
| 1046 |
define({ |
| 1047 |
tag: 'style', |
| 1048 |
name: 'HTMLStyleElement', |
| 1049 |
ctor: function HTMLStyleElement(doc, localName, prefix) { |
| 1050 |
HTMLElement.call(this, doc, localName, prefix); |
| 1051 |
}, |
| 1052 |
attributes: { |
| 1053 |
media: String, |
| 1054 |
type: String, |
| 1055 |
scoped: Boolean |
| 1056 |
} |
| 1057 |
}); |
| 1058 |
|
| 1059 |
define({ |
| 1060 |
tag: 'caption', |
| 1061 |
name: 'HTMLTableCaptionElement', |
| 1062 |
ctor: function HTMLTableCaptionElement(doc, localName, prefix) { |
| 1063 |
HTMLElement.call(this, doc, localName, prefix); |
| 1064 |
}, |
| 1065 |
attributes: { |
| 1066 |
|
| 1067 |
align: String, |
| 1068 |
} |
| 1069 |
}); |
| 1070 |
|
| 1071 |
|
| 1072 |
define({ |
| 1073 |
name: 'HTMLTableCellElement', |
| 1074 |
ctor: function HTMLTableCellElement(doc, localName, prefix) { |
| 1075 |
HTMLElement.call(this, doc, localName, prefix); |
| 1076 |
}, |
| 1077 |
attributes: { |
| 1078 |
colSpan: {type: "unsigned long", default: 1}, |
| 1079 |
rowSpan: {type: "unsigned long", default: 1}, |
| 1080 |
|
| 1081 |
scope: { type: ['row','col','rowgroup','colgroup'], missing: '' }, |
| 1082 |
abbr: String, |
| 1083 |
|
| 1084 |
align: String, |
| 1085 |
axis: String, |
| 1086 |
height: String, |
| 1087 |
width: String, |
| 1088 |
ch: { name: 'char', type: String }, |
| 1089 |
chOff: { name: 'charoff', type: String }, |
| 1090 |
noWrap: Boolean, |
| 1091 |
vAlign: String, |
| 1092 |
bgColor: { type: String, treatNullAsEmptyString: true }, |
| 1093 |
} |
| 1094 |
}); |
| 1095 |
|
| 1096 |
define({ |
| 1097 |
tags: ['col', 'colgroup'], |
| 1098 |
name: 'HTMLTableColElement', |
| 1099 |
ctor: function HTMLTableColElement(doc, localName, prefix) { |
| 1100 |
HTMLElement.call(this, doc, localName, prefix); |
| 1101 |
}, |
| 1102 |
attributes: { |
| 1103 |
span: {type: 'limited unsigned long with fallback', default: 1, min: 1}, |
| 1104 |
|
| 1105 |
align: String, |
| 1106 |
ch: { name: 'char', type: String }, |
| 1107 |
chOff: { name: 'charoff', type: String }, |
| 1108 |
vAlign: String, |
| 1109 |
width: String, |
| 1110 |
} |
| 1111 |
}); |
| 1112 |
|
| 1113 |
define({ |
| 1114 |
tag: 'table', |
| 1115 |
name: 'HTMLTableElement', |
| 1116 |
ctor: function HTMLTableElement(doc, localName, prefix) { |
| 1117 |
HTMLElement.call(this, doc, localName, prefix); |
| 1118 |
}, |
| 1119 |
props: { |
| 1120 |
rows: { get: function() { |
| 1121 |
return this.getElementsByTagName('tr'); |
| 1122 |
}} |
| 1123 |
}, |
| 1124 |
attributes: { |
| 1125 |
|
| 1126 |
align: String, |
| 1127 |
border: String, |
| 1128 |
frame: String, |
| 1129 |
rules: String, |
| 1130 |
summary: String, |
| 1131 |
width: String, |
| 1132 |
bgColor: { type: String, treatNullAsEmptyString: true }, |
| 1133 |
cellPadding: { type: String, treatNullAsEmptyString: true }, |
| 1134 |
cellSpacing: { type: String, treatNullAsEmptyString: true }, |
| 1135 |
} |
| 1136 |
}); |
| 1137 |
|
| 1138 |
define({ |
| 1139 |
tag: 'template', |
| 1140 |
name: 'HTMLTemplateElement', |
| 1141 |
ctor: function HTMLTemplateElement(doc, localName, prefix) { |
| 1142 |
HTMLElement.call(this, doc, localName, prefix); |
| 1143 |
this._contentFragment = doc._templateDoc.createDocumentFragment(); |
| 1144 |
}, |
| 1145 |
props: { |
| 1146 |
content: { get: function() { return this._contentFragment; } }, |
| 1147 |
serialize: { value: function() { return this.content.serialize(); } } |
| 1148 |
} |
| 1149 |
}); |
| 1150 |
|
| 1151 |
define({ |
| 1152 |
tag: 'tr', |
| 1153 |
name: 'HTMLTableRowElement', |
| 1154 |
ctor: function HTMLTableRowElement(doc, localName, prefix) { |
| 1155 |
HTMLElement.call(this, doc, localName, prefix); |
| 1156 |
}, |
| 1157 |
props: { |
| 1158 |
cells: { get: function() { |
| 1159 |
return this.querySelectorAll('td,th'); |
| 1160 |
}} |
| 1161 |
}, |
| 1162 |
attributes: { |
| 1163 |
|
| 1164 |
align: String, |
| 1165 |
ch: { name: 'char', type: String }, |
| 1166 |
chOff: { name: 'charoff', type: String }, |
| 1167 |
vAlign: String, |
| 1168 |
bgColor: { type: String, treatNullAsEmptyString: true }, |
| 1169 |
}, |
| 1170 |
}); |
| 1171 |
|
| 1172 |
define({ |
| 1173 |
tags: ['thead', 'tfoot', 'tbody'], |
| 1174 |
name: 'HTMLTableSectionElement', |
| 1175 |
ctor: function HTMLTableSectionElement(doc, localName, prefix) { |
| 1176 |
HTMLElement.call(this, doc, localName, prefix); |
| 1177 |
}, |
| 1178 |
props: { |
| 1179 |
rows: { get: function() { |
| 1180 |
return this.getElementsByTagName('tr'); |
| 1181 |
}} |
| 1182 |
}, |
| 1183 |
attributes: { |
| 1184 |
|
| 1185 |
align: String, |
| 1186 |
ch: { name: 'char', type: String }, |
| 1187 |
chOff: { name: 'charoff', type: String }, |
| 1188 |
vAlign: String, |
| 1189 |
} |
| 1190 |
}); |
| 1191 |
|
| 1192 |
define({ |
| 1193 |
tag: 'textarea', |
| 1194 |
name: 'HTMLTextAreaElement', |
| 1195 |
ctor: function HTMLTextAreaElement(doc, localName, prefix) { |
| 1196 |
HTMLFormElement.call(this, doc, localName, prefix); |
| 1197 |
}, |
| 1198 |
props: { |
| 1199 |
form: formAssociatedProps.form, |
| 1200 |
type: { get: function() { return 'textarea'; } }, |
| 1201 |
defaultValue: { |
| 1202 |
get: function() { return this.textContent; }, |
| 1203 |
set: function(v) { this.textContent = v; }, |
| 1204 |
}, |
| 1205 |
value: { |
| 1206 |
get: function() { return this.defaultValue; }, |
| 1207 |
set: function(v) { |
| 1208 |
|
| 1209 |
|
| 1210 |
|
| 1211 |
|
| 1212 |
this.defaultValue = v; |
| 1213 |
}, |
| 1214 |
}, |
| 1215 |
textLength: { get: function() { return this.value.length; } }, |
| 1216 |
}, |
| 1217 |
attributes: { |
| 1218 |
autocomplete: String, |
| 1219 |
name: String, |
| 1220 |
disabled: Boolean, |
| 1221 |
autofocus: Boolean, |
| 1222 |
placeholder: String, |
| 1223 |
wrap: String, |
| 1224 |
dirName: String, |
| 1225 |
required: Boolean, |
| 1226 |
readOnly: Boolean, |
| 1227 |
rows: {type: 'limited unsigned long with fallback', default: 2 }, |
| 1228 |
cols: {type: 'limited unsigned long with fallback', default: 20 }, |
| 1229 |
maxLength: {type: 'unsigned long', min: 0, setmin: 0, default: -1}, |
| 1230 |
minLength: {type: 'unsigned long', min: 0, setmin: 0, default: -1}, |
| 1231 |
inputMode: { type: [ "verbatim", "latin", "latin-name", "latin-prose", "full-width-latin", "kana", "kana-name", "katakana", "numeric", "tel", "email", "url" ], missing: '' }, |
| 1232 |
} |
| 1233 |
}); |
| 1234 |
|
| 1235 |
define({ |
| 1236 |
tag: 'time', |
| 1237 |
name: 'HTMLTimeElement', |
| 1238 |
ctor: function HTMLTimeElement(doc, localName, prefix) { |
| 1239 |
HTMLElement.call(this, doc, localName, prefix); |
| 1240 |
}, |
| 1241 |
attributes: { |
| 1242 |
dateTime: String, |
| 1243 |
pubDate: Boolean |
| 1244 |
} |
| 1245 |
}); |
| 1246 |
|
| 1247 |
define({ |
| 1248 |
tag: 'title', |
| 1249 |
name: 'HTMLTitleElement', |
| 1250 |
ctor: function HTMLTitleElement(doc, localName, prefix) { |
| 1251 |
HTMLElement.call(this, doc, localName, prefix); |
| 1252 |
}, |
| 1253 |
props: { |
| 1254 |
text: { get: function() { |
| 1255 |
return this.textContent; |
| 1256 |
}} |
| 1257 |
} |
| 1258 |
}); |
| 1259 |
|
| 1260 |
define({ |
| 1261 |
tag: 'ul', |
| 1262 |
name: 'HTMLUListElement', |
| 1263 |
ctor: function HTMLUListElement(doc, localName, prefix) { |
| 1264 |
HTMLElement.call(this, doc, localName, prefix); |
| 1265 |
}, |
| 1266 |
attributes: { |
| 1267 |
type: String, |
| 1268 |
|
| 1269 |
compact: Boolean, |
| 1270 |
} |
| 1271 |
}); |
| 1272 |
|
| 1273 |
define({ |
| 1274 |
name: 'HTMLMediaElement', |
| 1275 |
ctor: function HTMLMediaElement(doc, localName, prefix) { |
| 1276 |
HTMLElement.call(this, doc, localName, prefix); |
| 1277 |
}, |
| 1278 |
attributes: { |
| 1279 |
src: URL, |
| 1280 |
crossOrigin: CORS, |
| 1281 |
preload: { type:["metadata", "none", "auto", {value: "", alias: "auto"}], missing: 'auto' }, |
| 1282 |
loop: Boolean, |
| 1283 |
autoplay: Boolean, |
| 1284 |
mediaGroup: String, |
| 1285 |
controls: Boolean, |
| 1286 |
defaultMuted: {name: "muted", type: Boolean} |
| 1287 |
} |
| 1288 |
}); |
| 1289 |
|
| 1290 |
define({ |
| 1291 |
name: 'HTMLAudioElement', |
| 1292 |
tag: 'audio', |
| 1293 |
superclass: htmlElements.HTMLMediaElement, |
| 1294 |
ctor: function HTMLAudioElement(doc, localName, prefix) { |
| 1295 |
htmlElements.HTMLMediaElement.call(this, doc, localName, prefix); |
| 1296 |
} |
| 1297 |
}); |
| 1298 |
|
| 1299 |
define({ |
| 1300 |
name: 'HTMLVideoElement', |
| 1301 |
tag: 'video', |
| 1302 |
superclass: htmlElements.HTMLMediaElement, |
| 1303 |
ctor: function HTMLVideoElement(doc, localName, prefix) { |
| 1304 |
htmlElements.HTMLMediaElement.call(this, doc, localName, prefix); |
| 1305 |
}, |
| 1306 |
attributes: { |
| 1307 |
poster: URL, |
| 1308 |
width: {type: "unsigned long", min: 0, default: 0 }, |
| 1309 |
height: {type: "unsigned long", min: 0, default: 0 } |
| 1310 |
} |
| 1311 |
}); |
| 1312 |
|
| 1313 |
define({ |
| 1314 |
tag: 'td', |
| 1315 |
name: 'HTMLTableDataCellElement', |
| 1316 |
superclass: htmlElements.HTMLTableCellElement, |
| 1317 |
ctor: function HTMLTableDataCellElement(doc, localName, prefix) { |
| 1318 |
htmlElements.HTMLTableCellElement.call(this, doc, localName, prefix); |
| 1319 |
} |
| 1320 |
}); |
| 1321 |
|
| 1322 |
define({ |
| 1323 |
tag: 'th', |
| 1324 |
name: 'HTMLTableHeaderCellElement', |
| 1325 |
superclass: htmlElements.HTMLTableCellElement, |
| 1326 |
ctor: function HTMLTableHeaderCellElement(doc, localName, prefix) { |
| 1327 |
htmlElements.HTMLTableCellElement.call(this, doc, localName, prefix); |
| 1328 |
}, |
| 1329 |
}); |
| 1330 |
|
| 1331 |
define({ |
| 1332 |
tag: 'frameset', |
| 1333 |
name: 'HTMLFrameSetElement', |
| 1334 |
ctor: function HTMLFrameSetElement(doc, localName, prefix) { |
| 1335 |
HTMLElement.call(this, doc, localName, prefix); |
| 1336 |
} |
| 1337 |
}); |
| 1338 |
|
| 1339 |
define({ |
| 1340 |
tag: 'frame', |
| 1341 |
name: 'HTMLFrameElement', |
| 1342 |
ctor: function HTMLFrameElement(doc, localName, prefix) { |
| 1343 |
HTMLElement.call(this, doc, localName, prefix); |
| 1344 |
} |
| 1345 |
}); |
| 1346 |
|
| 1347 |
define({ |
| 1348 |
tag: 'canvas', |
| 1349 |
name: 'HTMLCanvasElement', |
| 1350 |
ctor: function HTMLCanvasElement(doc, localName, prefix) { |
| 1351 |
HTMLElement.call(this, doc, localName, prefix); |
| 1352 |
}, |
| 1353 |
props: { |
| 1354 |
getContext: { value: utils.nyi }, |
| 1355 |
probablySupportsContext: { value: utils.nyi }, |
| 1356 |
setContext: { value: utils.nyi }, |
| 1357 |
transferControlToProxy: { value: utils.nyi }, |
| 1358 |
toDataURL: { value: utils.nyi }, |
| 1359 |
toBlob: { value: utils.nyi } |
| 1360 |
}, |
| 1361 |
attributes: { |
| 1362 |
width: { type: "unsigned long", default: 300}, |
| 1363 |
height: { type: "unsigned long", default: 150} |
| 1364 |
} |
| 1365 |
}); |
| 1366 |
|
| 1367 |
define({ |
| 1368 |
tag: 'dialog', |
| 1369 |
name: 'HTMLDialogElement', |
| 1370 |
ctor: function HTMLDialogElement(doc, localName, prefix) { |
| 1371 |
HTMLElement.call(this, doc, localName, prefix); |
| 1372 |
}, |
| 1373 |
props: { |
| 1374 |
show: { value: utils.nyi }, |
| 1375 |
showModal: { value: utils.nyi }, |
| 1376 |
close: { value: utils.nyi } |
| 1377 |
}, |
| 1378 |
attributes: { |
| 1379 |
open: Boolean, |
| 1380 |
returnValue: String |
| 1381 |
} |
| 1382 |
}); |
| 1383 |
|
| 1384 |
define({ |
| 1385 |
tag: 'menuitem', |
| 1386 |
name: 'HTMLMenuItemElement', |
| 1387 |
ctor: function HTMLMenuItemElement(doc, localName, prefix) { |
| 1388 |
HTMLElement.call(this, doc, localName, prefix); |
| 1389 |
}, |
| 1390 |
props: { |
| 1391 |
|
| 1392 |
_label: { |
| 1393 |
get: function() { |
| 1394 |
var val = this._getattr('label'); |
| 1395 |
if (val !== null && val !== '') { return val; } |
| 1396 |
val = this.textContent; |
| 1397 |
|
| 1398 |
return val.replace(/[ \t\n\f\r]+/g, ' ').trim(); |
| 1399 |
} |
| 1400 |
}, |
| 1401 |
|
| 1402 |
label: { |
| 1403 |
get: function() { |
| 1404 |
var val = this._getattr('label'); |
| 1405 |
if (val !== null) { return val; } |
| 1406 |
return this._label; |
| 1407 |
}, |
| 1408 |
set: function(v) { |
| 1409 |
this._setattr('label', v); |
| 1410 |
}, |
| 1411 |
} |
| 1412 |
}, |
| 1413 |
attributes: { |
| 1414 |
type: { type: ["command","checkbox","radio"], missing: 'command' }, |
| 1415 |
icon: URL, |
| 1416 |
disabled: Boolean, |
| 1417 |
checked: Boolean, |
| 1418 |
radiogroup: String, |
| 1419 |
default: Boolean |
| 1420 |
} |
| 1421 |
}); |
| 1422 |
|
| 1423 |
define({ |
| 1424 |
tag: 'source', |
| 1425 |
name: 'HTMLSourceElement', |
| 1426 |
ctor: function HTMLSourceElement(doc, localName, prefix) { |
| 1427 |
HTMLElement.call(this, doc, localName, prefix); |
| 1428 |
}, |
| 1429 |
attributes: { |
| 1430 |
srcset: String, |
| 1431 |
sizes: String, |
| 1432 |
media: String, |
| 1433 |
src: URL, |
| 1434 |
type: String, |
| 1435 |
width: String, |
| 1436 |
height: String, |
| 1437 |
} |
| 1438 |
}); |
| 1439 |
|
| 1440 |
define({ |
| 1441 |
tag: 'track', |
| 1442 |
name: 'HTMLTrackElement', |
| 1443 |
ctor: function HTMLTrackElement(doc, localName, prefix) { |
| 1444 |
HTMLElement.call(this, doc, localName, prefix); |
| 1445 |
}, |
| 1446 |
attributes: { |
| 1447 |
src: URL, |
| 1448 |
srclang: String, |
| 1449 |
label: String, |
| 1450 |
default: Boolean, |
| 1451 |
kind: { type: ["subtitles", "captions", "descriptions", "chapters", "metadata"], missing: 'subtitles', invalid: 'metadata' }, |
| 1452 |
}, |
| 1453 |
props: { |
| 1454 |
NONE: { get: function() { return 0; } }, |
| 1455 |
LOADING: { get: function() { return 1; } }, |
| 1456 |
LOADED: { get: function() { return 2; } }, |
| 1457 |
ERROR: { get: function() { return 3; } }, |
| 1458 |
readyState: { get: utils.nyi }, |
| 1459 |
track: { get: utils.nyi } |
| 1460 |
} |
| 1461 |
}); |
| 1462 |
|
| 1463 |
define({ |
| 1464 |
|
| 1465 |
tag: 'font', |
| 1466 |
name: 'HTMLFontElement', |
| 1467 |
ctor: function HTMLFontElement(doc, localName, prefix) { |
| 1468 |
HTMLElement.call(this, doc, localName, prefix); |
| 1469 |
}, |
| 1470 |
attributes: { |
| 1471 |
color: { type: String, treatNullAsEmptyString: true }, |
| 1472 |
face: { type: String }, |
| 1473 |
size: { type: String }, |
| 1474 |
}, |
| 1475 |
}); |
| 1476 |
|
| 1477 |
define({ |
| 1478 |
|
| 1479 |
tag: 'dir', |
| 1480 |
name: 'HTMLDirectoryElement', |
| 1481 |
ctor: function HTMLDirectoryElement(doc, localName, prefix) { |
| 1482 |
HTMLElement.call(this, doc, localName, prefix); |
| 1483 |
}, |
| 1484 |
attributes: { |
| 1485 |
compact: Boolean, |
| 1486 |
}, |
| 1487 |
}); |
| 1488 |
|
| 1489 |
define({ |
| 1490 |
tags: [ |
| 1491 |
"abbr", "address", "article", "aside", "b", "bdi", "bdo", "cite", "content", "code", |
| 1492 |
"dd", "dfn", "dt", "em", "figcaption", "figure", "footer", "header", "hgroup", "i", "kbd", |
| 1493 |
"main", "mark", "nav", "noscript", "rb", "rp", "rt", "rtc", |
| 1494 |
"ruby", "s", "samp", "section", "small", "strong", "sub", "summary", "sup", "u", "var", "wbr", |
| 1495 |
|
| 1496 |
"acronym", "basefont", "big", "center", "nobr", "noembed", "noframes", |
| 1497 |
"plaintext", "strike", "tt" |
| 1498 |
] |
| 1499 |
}); |