1'use strict'; 2 3const NS = (exports.NAMESPACES = { 4 HTML: 'http://www.w3.org/1999/xhtml', 5 MATHML: 'http://www.w3.org/1998/Math/MathML', 6 SVG: 'http://www.w3.org/2000/svg', 7 XLINK: 'http://www.w3.org/1999/xlink', 8 XML: 'http://www.w3.org/XML/1998/namespace', 9 XMLNS: 'http://www.w3.org/2000/xmlns/' 10}); 11 12exports.ATTRS = { 13 TYPE: 'type', 14 ACTION: 'action', 15 ENCODING: 'encoding', 16 PROMPT: 'prompt', 17 NAME: 'name', 18 COLOR: 'color', 19 FACE: 'face', 20 SIZE: 'size' 21}; 22 23exports.DOCUMENT_MODE = { 24 NO_QUIRKS: 'no-quirks', 25 QUIRKS: 'quirks', 26 LIMITED_QUIRKS: 'limited-quirks' 27}; 28 29const $ = (exports.TAG_NAMES = { 30 A: 'a', 31 ADDRESS: 'address', 32 ANNOTATION_XML: 'annotation-xml', 33 APPLET: 'applet', 34 AREA: 'area', 35 ARTICLE: 'article', 36 ASIDE: 'aside', 37 38 B: 'b', 39 BASE: 'base', 40 BASEFONT: 'basefont', 41 BGSOUND: 'bgsound', 42 BIG: 'big', 43 BLOCKQUOTE: 'blockquote', 44 BODY: 'body', 45 BR: 'br', 46 BUTTON: 'button', 47 48 CAPTION: 'caption', 49 CENTER: 'center', 50 CODE: 'code', 51 COL: 'col', 52 COLGROUP: 'colgroup', 53 54 DD: 'dd', 55 DESC: 'desc', 56 DETAILS: 'details', 57 DIALOG: 'dialog', 58 DIR: 'dir', 59 DIV: 'div', 60 DL: 'dl', 61 DT: 'dt', 62 63 EM: 'em', 64 EMBED: 'embed', 65 66 FIELDSET: 'fieldset', 67 FIGCAPTION: 'figcaption', 68 FIGURE: 'figure', 69 FONT: 'font', 70 FOOTER: 'footer', 71 FOREIGN_OBJECT: 'foreignObject', 72 FORM: 'form', 73 FRAME: 'frame', 74 FRAMESET: 'frameset', 75 76 H1: 'h1', 77 H2: 'h2', 78 H3: 'h3', 79 H4: 'h4', 80 H5: 'h5', 81 H6: 'h6', 82 HEAD: 'head', 83 HEADER: 'header', 84 HGROUP: 'hgroup', 85 HR: 'hr', 86 HTML: 'html', 87 88 I: 'i', 89 IMG: 'img', 90 IMAGE: 'image', 91 INPUT: 'input', 92 IFRAME: 'iframe', 93 94 KEYGEN: 'keygen', 95 96 LABEL: 'label', 97 LI: 'li', 98 LINK: 'link', 99 LISTING: 'listing', 100 101 MAIN: 'main', 102 MALIGNMARK: 'malignmark', 103 MARQUEE: 'marquee', 104 MATH: 'math', 105 MENU: 'menu', 106 META: 'meta', 107 MGLYPH: 'mglyph', 108 MI: 'mi', 109 MO: 'mo', 110 MN: 'mn', 111 MS: 'ms', 112 MTEXT: 'mtext', 113 114 NAV: 'nav', 115 NOBR: 'nobr', 116 NOFRAMES: 'noframes', 117 NOEMBED: 'noembed', 118 NOSCRIPT: 'noscript', 119 120 OBJECT: 'object', 121 OL: 'ol', 122 OPTGROUP: 'optgroup', 123 OPTION: 'option', 124 125 P: 'p', 126 PARAM: 'param', 127 PLAINTEXT: 'plaintext', 128 PRE: 'pre', 129 130 RB: 'rb', 131 RP: 'rp', 132 RT: 'rt', 133 RTC: 'rtc', 134 RUBY: 'ruby', 135 136 S: 's', 137 SCRIPT: 'script', 138 SECTION: 'section', 139 SELECT: 'select', 140 SOURCE: 'source', 141 SMALL: 'small', 142 SPAN: 'span', 143 STRIKE: 'strike', 144 STRONG: 'strong', 145 STYLE: 'style', 146 SUB: 'sub', 147 SUMMARY: 'summary', 148 SUP: 'sup', 149 150 TABLE: 'table', 151 TBODY: 'tbody', 152 TEMPLATE: 'template', 153 TEXTAREA: 'textarea', 154 TFOOT: 'tfoot', 155 TD: 'td', 156 TH: 'th', 157 THEAD: 'thead', 158 TITLE: 'title', 159 TR: 'tr', 160 TRACK: 'track', 161 TT: 'tt', 162 163 U: 'u', 164 UL: 'ul', 165 166 SVG: 'svg', 167 168 VAR: 'var', 169 170 WBR: 'wbr', 171 172 XMP: 'xmp' 173}); 174 175exports.SPECIAL_ELEMENTS = { 176 [NS.HTML]: { 177 [$.ADDRESS]: true, 178 [$.APPLET]: true, 179 [$.AREA]: true, 180 [$.ARTICLE]: true, 181 [$.ASIDE]: true, 182 [$.BASE]: true, 183 [$.BASEFONT]: true, 184 [$.BGSOUND]: true, 185 [$.BLOCKQUOTE]: true, 186 [$.BODY]: true, 187 [$.BR]: true, 188 [$.BUTTON]: true, 189 [$.CAPTION]: true, 190 [$.CENTER]: true, 191 [$.COL]: true, 192 [$.COLGROUP]: true, 193 [$.DD]: true, 194 [$.DETAILS]: true, 195 [$.DIR]: true, 196 [$.DIV]: true, 197 [$.DL]: true, 198 [$.DT]: true, 199 [$.EMBED]: true, 200 [$.FIELDSET]: true, 201 [$.FIGCAPTION]: true, 202 [$.FIGURE]: true, 203 [$.FOOTER]: true, 204 [$.FORM]: true, 205 [$.FRAME]: true, 206 [$.FRAMESET]: true, 207 [$.H1]: true, 208 [$.H2]: true, 209 [$.H3]: true, 210 [$.H4]: true, 211 [$.H5]: true, 212 [$.H6]: true, 213 [$.HEAD]: true, 214 [$.HEADER]: true, 215 [$.HGROUP]: true, 216 [$.HR]: true, 217 [$.HTML]: true, 218 [$.IFRAME]: true, 219 [$.IMG]: true, 220 [$.INPUT]: true, 221 [$.LI]: true, 222 [$.LINK]: true, 223 [$.LISTING]: true, 224 [$.MAIN]: true, 225 [$.MARQUEE]: true, 226 [$.MENU]: true, 227 [$.META]: true, 228 [$.NAV]: true, 229 [$.NOEMBED]: true, 230 [$.NOFRAMES]: true, 231 [$.NOSCRIPT]: true, 232 [$.OBJECT]: true, 233 [$.OL]: true, 234 [$.P]: true, 235 [$.PARAM]: true, 236 [$.PLAINTEXT]: true, 237 [$.PRE]: true, 238 [$.SCRIPT]: true, 239 [$.SECTION]: true, 240 [$.SELECT]: true, 241 [$.SOURCE]: true, 242 [$.STYLE]: true, 243 [$.SUMMARY]: true, 244 [$.TABLE]: true, 245 [$.TBODY]: true, 246 [$.TD]: true, 247 [$.TEMPLATE]: true, 248 [$.TEXTAREA]: true, 249 [$.TFOOT]: true, 250 [$.TH]: true, 251 [$.THEAD]: true, 252 [$.TITLE]: true, 253 [$.TR]: true, 254 [$.TRACK]: true, 255 [$.UL]: true, 256 [$.WBR]: true, 257 [$.XMP]: true 258 }, 259 [NS.MATHML]: { 260 [$.MI]: true, 261 [$.MO]: true, 262 [$.MN]: true, 263 [$.MS]: true, 264 [$.MTEXT]: true, 265 [$.ANNOTATION_XML]: true 266 }, 267 [NS.SVG]: { 268 [$.TITLE]: true, 269 [$.FOREIGN_OBJECT]: true, 270 [$.DESC]: true 271 } 272}; 273