Chinthakayala,Sheshashailavas(sc2914) | 8f6a6c4 | 2018-06-27 16:11:44 +0000 | [diff] [blame] | 1 | "no use strict"; |
| 2 | !(function(window) { |
| 3 | if (typeof window.window != "undefined" && window.document) |
| 4 | return; |
| 5 | if (window.require && window.define) |
| 6 | return; |
| 7 | |
| 8 | if (!window.console) { |
| 9 | window.console = function() { |
| 10 | var msgs = Array.prototype.slice.call(arguments, 0); |
| 11 | postMessage({type: "log", data: msgs}); |
| 12 | }; |
| 13 | window.console.error = |
| 14 | window.console.warn = |
| 15 | window.console.log = |
| 16 | window.console.trace = window.console; |
| 17 | } |
| 18 | window.window = window; |
| 19 | window.ace = window; |
| 20 | |
| 21 | window.onerror = function(message, file, line, col, err) { |
| 22 | postMessage({type: "error", data: { |
| 23 | message: message, |
| 24 | data: err.data, |
| 25 | file: file, |
| 26 | line: line, |
| 27 | col: col, |
| 28 | stack: err.stack |
| 29 | }}); |
| 30 | }; |
| 31 | |
| 32 | window.normalizeModule = function(parentId, moduleName) { |
| 33 | // normalize plugin requires |
| 34 | if (moduleName.indexOf("!") !== -1) { |
| 35 | var chunks = moduleName.split("!"); |
| 36 | return window.normalizeModule(parentId, chunks[0]) + "!" + window.normalizeModule(parentId, chunks[1]); |
| 37 | } |
| 38 | // normalize relative requires |
| 39 | if (moduleName.charAt(0) == ".") { |
| 40 | var base = parentId.split("/").slice(0, -1).join("/"); |
| 41 | moduleName = (base ? base + "/" : "") + moduleName; |
| 42 | |
| 43 | while (moduleName.indexOf(".") !== -1 && previous != moduleName) { |
| 44 | var previous = moduleName; |
| 45 | moduleName = moduleName.replace(/^\.\//, "").replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, ""); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | return moduleName; |
| 50 | }; |
| 51 | |
| 52 | window.require = function require(parentId, id) { |
| 53 | if (!id) { |
| 54 | id = parentId; |
| 55 | parentId = null; |
| 56 | } |
| 57 | if (!id.charAt) |
| 58 | throw new Error("worker.js require() accepts only (parentId, id) as arguments"); |
| 59 | |
| 60 | id = window.normalizeModule(parentId, id); |
| 61 | |
| 62 | var module = window.require.modules[id]; |
| 63 | if (module) { |
| 64 | if (!module.initialized) { |
| 65 | module.initialized = true; |
| 66 | module.exports = module.factory().exports; |
| 67 | } |
| 68 | return module.exports; |
| 69 | } |
| 70 | |
| 71 | if (!window.require.tlns) |
| 72 | return console.log("unable to load " + id); |
| 73 | |
| 74 | var path = resolveModuleId(id, window.require.tlns); |
| 75 | if (path.slice(-3) != ".js") path += ".js"; |
| 76 | |
| 77 | window.require.id = id; |
| 78 | window.require.modules[id] = {}; // prevent infinite loop on broken modules |
| 79 | importScripts(path); |
| 80 | return window.require(parentId, id); |
| 81 | }; |
| 82 | function resolveModuleId(id, paths) { |
| 83 | var testPath = id, tail = ""; |
| 84 | while (testPath) { |
| 85 | var alias = paths[testPath]; |
| 86 | if (typeof alias == "string") { |
| 87 | return alias + tail; |
| 88 | } else if (alias) { |
| 89 | return alias.location.replace(/\/*$/, "/") + (tail || alias.main || alias.name); |
| 90 | } else if (alias === false) { |
| 91 | return ""; |
| 92 | } |
| 93 | var i = testPath.lastIndexOf("/"); |
| 94 | if (i === -1) break; |
| 95 | tail = testPath.substr(i) + tail; |
| 96 | testPath = testPath.slice(0, i); |
| 97 | } |
| 98 | return id; |
| 99 | } |
| 100 | window.require.modules = {}; |
| 101 | window.require.tlns = {}; |
| 102 | |
| 103 | window.define = function(id, deps, factory) { |
| 104 | if (arguments.length == 2) { |
| 105 | factory = deps; |
| 106 | if (typeof id != "string") { |
| 107 | deps = id; |
| 108 | id = window.require.id; |
| 109 | } |
| 110 | } else if (arguments.length == 1) { |
| 111 | factory = id; |
| 112 | deps = []; |
| 113 | id = window.require.id; |
| 114 | } |
| 115 | |
| 116 | if (typeof factory != "function") { |
| 117 | window.require.modules[id] = { |
| 118 | exports: factory, |
| 119 | initialized: true |
| 120 | }; |
| 121 | return; |
| 122 | } |
| 123 | |
| 124 | if (!deps.length) |
| 125 | // If there is no dependencies, we inject "require", "exports" and |
| 126 | // "module" as dependencies, to provide CommonJS compatibility. |
| 127 | deps = ["require", "exports", "module"]; |
| 128 | |
| 129 | var req = function(childId) { |
| 130 | return window.require(id, childId); |
| 131 | }; |
| 132 | |
| 133 | window.require.modules[id] = { |
| 134 | exports: {}, |
| 135 | factory: function() { |
| 136 | var module = this; |
| 137 | var returnExports = factory.apply(this, deps.map(function(dep) { |
| 138 | switch (dep) { |
| 139 | // Because "require", "exports" and "module" aren't actual |
| 140 | // dependencies, we must handle them seperately. |
| 141 | case "require": return req; |
| 142 | case "exports": return module.exports; |
| 143 | case "module": return module; |
| 144 | // But for all other dependencies, we can just go ahead and |
| 145 | // require them. |
| 146 | default: return req(dep); |
| 147 | } |
| 148 | })); |
| 149 | if (returnExports) |
| 150 | module.exports = returnExports; |
| 151 | return module; |
| 152 | } |
| 153 | }; |
| 154 | }; |
| 155 | window.define.amd = {}; |
| 156 | require.tlns = {}; |
| 157 | window.initBaseUrls = function initBaseUrls(topLevelNamespaces) { |
| 158 | for (var i in topLevelNamespaces) |
| 159 | require.tlns[i] = topLevelNamespaces[i]; |
| 160 | }; |
| 161 | |
| 162 | window.initSender = function initSender() { |
| 163 | |
| 164 | var EventEmitter = window.require("ace/lib/event_emitter").EventEmitter; |
| 165 | var oop = window.require("ace/lib/oop"); |
| 166 | |
| 167 | var Sender = function() {}; |
| 168 | |
| 169 | (function() { |
| 170 | |
| 171 | oop.implement(this, EventEmitter); |
| 172 | |
| 173 | this.callback = function(data, callbackId) { |
| 174 | postMessage({ |
| 175 | type: "call", |
| 176 | id: callbackId, |
| 177 | data: data |
| 178 | }); |
| 179 | }; |
| 180 | |
| 181 | this.emit = function(name, data) { |
| 182 | postMessage({ |
| 183 | type: "event", |
| 184 | name: name, |
| 185 | data: data |
| 186 | }); |
| 187 | }; |
| 188 | |
| 189 | }).call(Sender.prototype); |
| 190 | |
| 191 | return new Sender(); |
| 192 | }; |
| 193 | |
| 194 | var main = window.main = null; |
| 195 | var sender = window.sender = null; |
| 196 | |
| 197 | window.onmessage = function(e) { |
| 198 | var msg = e.data; |
| 199 | if (msg.event && sender) { |
| 200 | sender._signal(msg.event, msg.data); |
| 201 | } |
| 202 | else if (msg.command) { |
| 203 | if (main[msg.command]) |
| 204 | main[msg.command].apply(main, msg.args); |
| 205 | else if (window[msg.command]) |
| 206 | window[msg.command].apply(window, msg.args); |
| 207 | else |
| 208 | throw new Error("Unknown command:" + msg.command); |
| 209 | } |
| 210 | else if (msg.init) { |
| 211 | window.initBaseUrls(msg.tlns); |
| 212 | require("ace/lib/es5-shim"); |
| 213 | sender = window.sender = window.initSender(); |
| 214 | var clazz = require(msg.module)[msg.classname]; |
| 215 | main = window.main = new clazz(sender); |
| 216 | } |
| 217 | }; |
| 218 | })(this); |
| 219 | |
| 220 | define("ace/lib/oop",["require","exports","module"], function(require, exports, module) { |
| 221 | "use strict"; |
| 222 | |
| 223 | exports.inherits = function(ctor, superCtor) { |
| 224 | ctor.super_ = superCtor; |
| 225 | ctor.prototype = Object.create(superCtor.prototype, { |
| 226 | constructor: { |
| 227 | value: ctor, |
| 228 | enumerable: false, |
| 229 | writable: true, |
| 230 | configurable: true |
| 231 | } |
| 232 | }); |
| 233 | }; |
| 234 | |
| 235 | exports.mixin = function(obj, mixin) { |
| 236 | for (var key in mixin) { |
| 237 | obj[key] = mixin[key]; |
| 238 | } |
| 239 | return obj; |
| 240 | }; |
| 241 | |
| 242 | exports.implement = function(proto, mixin) { |
| 243 | exports.mixin(proto, mixin); |
| 244 | }; |
| 245 | |
| 246 | }); |
| 247 | |
| 248 | define("ace/lib/lang",["require","exports","module"], function(require, exports, module) { |
| 249 | "use strict"; |
| 250 | |
| 251 | exports.last = function(a) { |
| 252 | return a[a.length - 1]; |
| 253 | }; |
| 254 | |
| 255 | exports.stringReverse = function(string) { |
| 256 | return string.split("").reverse().join(""); |
| 257 | }; |
| 258 | |
| 259 | exports.stringRepeat = function (string, count) { |
| 260 | var result = ''; |
| 261 | while (count > 0) { |
| 262 | if (count & 1) |
| 263 | result += string; |
| 264 | |
| 265 | if (count >>= 1) |
| 266 | string += string; |
| 267 | } |
| 268 | return result; |
| 269 | }; |
| 270 | |
| 271 | var trimBeginRegexp = /^\s\s*/; |
| 272 | var trimEndRegexp = /\s\s*$/; |
| 273 | |
| 274 | exports.stringTrimLeft = function (string) { |
| 275 | return string.replace(trimBeginRegexp, ''); |
| 276 | }; |
| 277 | |
| 278 | exports.stringTrimRight = function (string) { |
| 279 | return string.replace(trimEndRegexp, ''); |
| 280 | }; |
| 281 | |
| 282 | exports.copyObject = function(obj) { |
| 283 | var copy = {}; |
| 284 | for (var key in obj) { |
| 285 | copy[key] = obj[key]; |
| 286 | } |
| 287 | return copy; |
| 288 | }; |
| 289 | |
| 290 | exports.copyArray = function(array){ |
| 291 | var copy = []; |
| 292 | for (var i=0, l=array.length; i<l; i++) { |
| 293 | if (array[i] && typeof array[i] == "object") |
| 294 | copy[i] = this.copyObject(array[i]); |
| 295 | else |
| 296 | copy[i] = array[i]; |
| 297 | } |
| 298 | return copy; |
| 299 | }; |
| 300 | |
| 301 | exports.deepCopy = function deepCopy(obj) { |
| 302 | if (typeof obj !== "object" || !obj) |
| 303 | return obj; |
| 304 | var copy; |
| 305 | if (Array.isArray(obj)) { |
| 306 | copy = []; |
| 307 | for (var key = 0; key < obj.length; key++) { |
| 308 | copy[key] = deepCopy(obj[key]); |
| 309 | } |
| 310 | return copy; |
| 311 | } |
| 312 | if (Object.prototype.toString.call(obj) !== "[object Object]") |
| 313 | return obj; |
| 314 | |
| 315 | copy = {}; |
| 316 | for (var key in obj) |
| 317 | copy[key] = deepCopy(obj[key]); |
| 318 | return copy; |
| 319 | }; |
| 320 | |
| 321 | exports.arrayToMap = function(arr) { |
| 322 | var map = {}; |
| 323 | for (var i=0; i<arr.length; i++) { |
| 324 | map[arr[i]] = 1; |
| 325 | } |
| 326 | return map; |
| 327 | |
| 328 | }; |
| 329 | |
| 330 | exports.createMap = function(props) { |
| 331 | var map = Object.create(null); |
| 332 | for (var i in props) { |
| 333 | map[i] = props[i]; |
| 334 | } |
| 335 | return map; |
| 336 | }; |
| 337 | exports.arrayRemove = function(array, value) { |
| 338 | for (var i = 0; i <= array.length; i++) { |
| 339 | if (value === array[i]) { |
| 340 | array.splice(i, 1); |
| 341 | } |
| 342 | } |
| 343 | }; |
| 344 | |
| 345 | exports.escapeRegExp = function(str) { |
| 346 | return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1'); |
| 347 | }; |
| 348 | |
| 349 | exports.escapeHTML = function(str) { |
| 350 | return str.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<"); |
| 351 | }; |
| 352 | |
| 353 | exports.getMatchOffsets = function(string, regExp) { |
| 354 | var matches = []; |
| 355 | |
| 356 | string.replace(regExp, function(str) { |
| 357 | matches.push({ |
| 358 | offset: arguments[arguments.length-2], |
| 359 | length: str.length |
| 360 | }); |
| 361 | }); |
| 362 | |
| 363 | return matches; |
| 364 | }; |
| 365 | exports.deferredCall = function(fcn) { |
| 366 | var timer = null; |
| 367 | var callback = function() { |
| 368 | timer = null; |
| 369 | fcn(); |
| 370 | }; |
| 371 | |
| 372 | var deferred = function(timeout) { |
| 373 | deferred.cancel(); |
| 374 | timer = setTimeout(callback, timeout || 0); |
| 375 | return deferred; |
| 376 | }; |
| 377 | |
| 378 | deferred.schedule = deferred; |
| 379 | |
| 380 | deferred.call = function() { |
| 381 | this.cancel(); |
| 382 | fcn(); |
| 383 | return deferred; |
| 384 | }; |
| 385 | |
| 386 | deferred.cancel = function() { |
| 387 | clearTimeout(timer); |
| 388 | timer = null; |
| 389 | return deferred; |
| 390 | }; |
| 391 | |
| 392 | deferred.isPending = function() { |
| 393 | return timer; |
| 394 | }; |
| 395 | |
| 396 | return deferred; |
| 397 | }; |
| 398 | |
| 399 | |
| 400 | exports.delayedCall = function(fcn, defaultTimeout) { |
| 401 | var timer = null; |
| 402 | var callback = function() { |
| 403 | timer = null; |
| 404 | fcn(); |
| 405 | }; |
| 406 | |
| 407 | var _self = function(timeout) { |
| 408 | if (timer == null) |
| 409 | timer = setTimeout(callback, timeout || defaultTimeout); |
| 410 | }; |
| 411 | |
| 412 | _self.delay = function(timeout) { |
| 413 | timer && clearTimeout(timer); |
| 414 | timer = setTimeout(callback, timeout || defaultTimeout); |
| 415 | }; |
| 416 | _self.schedule = _self; |
| 417 | |
| 418 | _self.call = function() { |
| 419 | this.cancel(); |
| 420 | fcn(); |
| 421 | }; |
| 422 | |
| 423 | _self.cancel = function() { |
| 424 | timer && clearTimeout(timer); |
| 425 | timer = null; |
| 426 | }; |
| 427 | |
| 428 | _self.isPending = function() { |
| 429 | return timer; |
| 430 | }; |
| 431 | |
| 432 | return _self; |
| 433 | }; |
| 434 | }); |
| 435 | |
| 436 | define("ace/range",["require","exports","module"], function(require, exports, module) { |
| 437 | "use strict"; |
| 438 | var comparePoints = function(p1, p2) { |
| 439 | return p1.row - p2.row || p1.column - p2.column; |
| 440 | }; |
| 441 | var Range = function(startRow, startColumn, endRow, endColumn) { |
| 442 | this.start = { |
| 443 | row: startRow, |
| 444 | column: startColumn |
| 445 | }; |
| 446 | |
| 447 | this.end = { |
| 448 | row: endRow, |
| 449 | column: endColumn |
| 450 | }; |
| 451 | }; |
| 452 | |
| 453 | (function() { |
| 454 | this.isEqual = function(range) { |
| 455 | return this.start.row === range.start.row && |
| 456 | this.end.row === range.end.row && |
| 457 | this.start.column === range.start.column && |
| 458 | this.end.column === range.end.column; |
| 459 | }; |
| 460 | this.toString = function() { |
| 461 | return ("Range: [" + this.start.row + "/" + this.start.column + |
| 462 | "] -> [" + this.end.row + "/" + this.end.column + "]"); |
| 463 | }; |
| 464 | |
| 465 | this.contains = function(row, column) { |
| 466 | return this.compare(row, column) == 0; |
| 467 | }; |
| 468 | this.compareRange = function(range) { |
| 469 | var cmp, |
| 470 | end = range.end, |
| 471 | start = range.start; |
| 472 | |
| 473 | cmp = this.compare(end.row, end.column); |
| 474 | if (cmp == 1) { |
| 475 | cmp = this.compare(start.row, start.column); |
| 476 | if (cmp == 1) { |
| 477 | return 2; |
| 478 | } else if (cmp == 0) { |
| 479 | return 1; |
| 480 | } else { |
| 481 | return 0; |
| 482 | } |
| 483 | } else if (cmp == -1) { |
| 484 | return -2; |
| 485 | } else { |
| 486 | cmp = this.compare(start.row, start.column); |
| 487 | if (cmp == -1) { |
| 488 | return -1; |
| 489 | } else if (cmp == 1) { |
| 490 | return 42; |
| 491 | } else { |
| 492 | return 0; |
| 493 | } |
| 494 | } |
| 495 | }; |
| 496 | this.comparePoint = function(p) { |
| 497 | return this.compare(p.row, p.column); |
| 498 | }; |
| 499 | this.containsRange = function(range) { |
| 500 | return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0; |
| 501 | }; |
| 502 | this.intersects = function(range) { |
| 503 | var cmp = this.compareRange(range); |
| 504 | return (cmp == -1 || cmp == 0 || cmp == 1); |
| 505 | }; |
| 506 | this.isEnd = function(row, column) { |
| 507 | return this.end.row == row && this.end.column == column; |
| 508 | }; |
| 509 | this.isStart = function(row, column) { |
| 510 | return this.start.row == row && this.start.column == column; |
| 511 | }; |
| 512 | this.setStart = function(row, column) { |
| 513 | if (typeof row == "object") { |
| 514 | this.start.column = row.column; |
| 515 | this.start.row = row.row; |
| 516 | } else { |
| 517 | this.start.row = row; |
| 518 | this.start.column = column; |
| 519 | } |
| 520 | }; |
| 521 | this.setEnd = function(row, column) { |
| 522 | if (typeof row == "object") { |
| 523 | this.end.column = row.column; |
| 524 | this.end.row = row.row; |
| 525 | } else { |
| 526 | this.end.row = row; |
| 527 | this.end.column = column; |
| 528 | } |
| 529 | }; |
| 530 | this.inside = function(row, column) { |
| 531 | if (this.compare(row, column) == 0) { |
| 532 | if (this.isEnd(row, column) || this.isStart(row, column)) { |
| 533 | return false; |
| 534 | } else { |
| 535 | return true; |
| 536 | } |
| 537 | } |
| 538 | return false; |
| 539 | }; |
| 540 | this.insideStart = function(row, column) { |
| 541 | if (this.compare(row, column) == 0) { |
| 542 | if (this.isEnd(row, column)) { |
| 543 | return false; |
| 544 | } else { |
| 545 | return true; |
| 546 | } |
| 547 | } |
| 548 | return false; |
| 549 | }; |
| 550 | this.insideEnd = function(row, column) { |
| 551 | if (this.compare(row, column) == 0) { |
| 552 | if (this.isStart(row, column)) { |
| 553 | return false; |
| 554 | } else { |
| 555 | return true; |
| 556 | } |
| 557 | } |
| 558 | return false; |
| 559 | }; |
| 560 | this.compare = function(row, column) { |
| 561 | if (!this.isMultiLine()) { |
| 562 | if (row === this.start.row) { |
| 563 | return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0); |
| 564 | } |
| 565 | } |
| 566 | |
| 567 | if (row < this.start.row) |
| 568 | return -1; |
| 569 | |
| 570 | if (row > this.end.row) |
| 571 | return 1; |
| 572 | |
| 573 | if (this.start.row === row) |
| 574 | return column >= this.start.column ? 0 : -1; |
| 575 | |
| 576 | if (this.end.row === row) |
| 577 | return column <= this.end.column ? 0 : 1; |
| 578 | |
| 579 | return 0; |
| 580 | }; |
| 581 | this.compareStart = function(row, column) { |
| 582 | if (this.start.row == row && this.start.column == column) { |
| 583 | return -1; |
| 584 | } else { |
| 585 | return this.compare(row, column); |
| 586 | } |
| 587 | }; |
| 588 | this.compareEnd = function(row, column) { |
| 589 | if (this.end.row == row && this.end.column == column) { |
| 590 | return 1; |
| 591 | } else { |
| 592 | return this.compare(row, column); |
| 593 | } |
| 594 | }; |
| 595 | this.compareInside = function(row, column) { |
| 596 | if (this.end.row == row && this.end.column == column) { |
| 597 | return 1; |
| 598 | } else if (this.start.row == row && this.start.column == column) { |
| 599 | return -1; |
| 600 | } else { |
| 601 | return this.compare(row, column); |
| 602 | } |
| 603 | }; |
| 604 | this.clipRows = function(firstRow, lastRow) { |
| 605 | if (this.end.row > lastRow) |
| 606 | var end = {row: lastRow + 1, column: 0}; |
| 607 | else if (this.end.row < firstRow) |
| 608 | var end = {row: firstRow, column: 0}; |
| 609 | |
| 610 | if (this.start.row > lastRow) |
| 611 | var start = {row: lastRow + 1, column: 0}; |
| 612 | else if (this.start.row < firstRow) |
| 613 | var start = {row: firstRow, column: 0}; |
| 614 | |
| 615 | return Range.fromPoints(start || this.start, end || this.end); |
| 616 | }; |
| 617 | this.extend = function(row, column) { |
| 618 | var cmp = this.compare(row, column); |
| 619 | |
| 620 | if (cmp == 0) |
| 621 | return this; |
| 622 | else if (cmp == -1) |
| 623 | var start = {row: row, column: column}; |
| 624 | else |
| 625 | var end = {row: row, column: column}; |
| 626 | |
| 627 | return Range.fromPoints(start || this.start, end || this.end); |
| 628 | }; |
| 629 | |
| 630 | this.isEmpty = function() { |
| 631 | return (this.start.row === this.end.row && this.start.column === this.end.column); |
| 632 | }; |
| 633 | this.isMultiLine = function() { |
| 634 | return (this.start.row !== this.end.row); |
| 635 | }; |
| 636 | this.clone = function() { |
| 637 | return Range.fromPoints(this.start, this.end); |
| 638 | }; |
| 639 | this.collapseRows = function() { |
| 640 | if (this.end.column == 0) |
| 641 | return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0); |
| 642 | else |
| 643 | return new Range(this.start.row, 0, this.end.row, 0); |
| 644 | }; |
| 645 | this.toScreenRange = function(session) { |
| 646 | var screenPosStart = session.documentToScreenPosition(this.start); |
| 647 | var screenPosEnd = session.documentToScreenPosition(this.end); |
| 648 | |
| 649 | return new Range( |
| 650 | screenPosStart.row, screenPosStart.column, |
| 651 | screenPosEnd.row, screenPosEnd.column |
| 652 | ); |
| 653 | }; |
| 654 | this.moveBy = function(row, column) { |
| 655 | this.start.row += row; |
| 656 | this.start.column += column; |
| 657 | this.end.row += row; |
| 658 | this.end.column += column; |
| 659 | }; |
| 660 | |
| 661 | }).call(Range.prototype); |
| 662 | Range.fromPoints = function(start, end) { |
| 663 | return new Range(start.row, start.column, end.row, end.column); |
| 664 | }; |
| 665 | Range.comparePoints = comparePoints; |
| 666 | |
| 667 | Range.comparePoints = function(p1, p2) { |
| 668 | return p1.row - p2.row || p1.column - p2.column; |
| 669 | }; |
| 670 | |
| 671 | |
| 672 | exports.Range = Range; |
| 673 | }); |
| 674 | |
| 675 | define("ace/apply_delta",["require","exports","module"], function(require, exports, module) { |
| 676 | "use strict"; |
| 677 | |
| 678 | function throwDeltaError(delta, errorText){ |
| 679 | console.log("Invalid Delta:", delta); |
| 680 | throw "Invalid Delta: " + errorText; |
| 681 | } |
| 682 | |
| 683 | function positionInDocument(docLines, position) { |
| 684 | return position.row >= 0 && position.row < docLines.length && |
| 685 | position.column >= 0 && position.column <= docLines[position.row].length; |
| 686 | } |
| 687 | |
| 688 | function validateDelta(docLines, delta) { |
| 689 | if (delta.action != "insert" && delta.action != "remove") |
| 690 | throwDeltaError(delta, "delta.action must be 'insert' or 'remove'"); |
| 691 | if (!(delta.lines instanceof Array)) |
| 692 | throwDeltaError(delta, "delta.lines must be an Array"); |
| 693 | if (!delta.start || !delta.end) |
| 694 | throwDeltaError(delta, "delta.start/end must be an present"); |
| 695 | var start = delta.start; |
| 696 | if (!positionInDocument(docLines, delta.start)) |
| 697 | throwDeltaError(delta, "delta.start must be contained in document"); |
| 698 | var end = delta.end; |
| 699 | if (delta.action == "remove" && !positionInDocument(docLines, end)) |
| 700 | throwDeltaError(delta, "delta.end must contained in document for 'remove' actions"); |
| 701 | var numRangeRows = end.row - start.row; |
| 702 | var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0)); |
| 703 | if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars) |
| 704 | throwDeltaError(delta, "delta.range must match delta lines"); |
| 705 | } |
| 706 | |
| 707 | exports.applyDelta = function(docLines, delta, doNotValidate) { |
| 708 | |
| 709 | var row = delta.start.row; |
| 710 | var startColumn = delta.start.column; |
| 711 | var line = docLines[row] || ""; |
| 712 | switch (delta.action) { |
| 713 | case "insert": |
| 714 | var lines = delta.lines; |
| 715 | if (lines.length === 1) { |
| 716 | docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn); |
| 717 | } else { |
| 718 | var args = [row, 1].concat(delta.lines); |
| 719 | docLines.splice.apply(docLines, args); |
| 720 | docLines[row] = line.substring(0, startColumn) + docLines[row]; |
| 721 | docLines[row + delta.lines.length - 1] += line.substring(startColumn); |
| 722 | } |
| 723 | break; |
| 724 | case "remove": |
| 725 | var endColumn = delta.end.column; |
| 726 | var endRow = delta.end.row; |
| 727 | if (row === endRow) { |
| 728 | docLines[row] = line.substring(0, startColumn) + line.substring(endColumn); |
| 729 | } else { |
| 730 | docLines.splice( |
| 731 | row, endRow - row + 1, |
| 732 | line.substring(0, startColumn) + docLines[endRow].substring(endColumn) |
| 733 | ); |
| 734 | } |
| 735 | break; |
| 736 | } |
| 737 | }; |
| 738 | }); |
| 739 | |
| 740 | define("ace/lib/event_emitter",["require","exports","module"], function(require, exports, module) { |
| 741 | "use strict"; |
| 742 | |
| 743 | var EventEmitter = {}; |
| 744 | var stopPropagation = function() { this.propagationStopped = true; }; |
| 745 | var preventDefault = function() { this.defaultPrevented = true; }; |
| 746 | |
| 747 | EventEmitter._emit = |
| 748 | EventEmitter._dispatchEvent = function(eventName, e) { |
| 749 | this._eventRegistry || (this._eventRegistry = {}); |
| 750 | this._defaultHandlers || (this._defaultHandlers = {}); |
| 751 | |
| 752 | var listeners = this._eventRegistry[eventName] || []; |
| 753 | var defaultHandler = this._defaultHandlers[eventName]; |
| 754 | if (!listeners.length && !defaultHandler) |
| 755 | return; |
| 756 | |
| 757 | if (typeof e != "object" || !e) |
| 758 | e = {}; |
| 759 | |
| 760 | if (!e.type) |
| 761 | e.type = eventName; |
| 762 | if (!e.stopPropagation) |
| 763 | e.stopPropagation = stopPropagation; |
| 764 | if (!e.preventDefault) |
| 765 | e.preventDefault = preventDefault; |
| 766 | |
| 767 | listeners = listeners.slice(); |
| 768 | for (var i=0; i<listeners.length; i++) { |
| 769 | listeners[i](e, this); |
| 770 | if (e.propagationStopped) |
| 771 | break; |
| 772 | } |
| 773 | |
| 774 | if (defaultHandler && !e.defaultPrevented) |
| 775 | return defaultHandler(e, this); |
| 776 | }; |
| 777 | |
| 778 | |
| 779 | EventEmitter._signal = function(eventName, e) { |
| 780 | var listeners = (this._eventRegistry || {})[eventName]; |
| 781 | if (!listeners) |
| 782 | return; |
| 783 | listeners = listeners.slice(); |
| 784 | for (var i=0; i<listeners.length; i++) |
| 785 | listeners[i](e, this); |
| 786 | }; |
| 787 | |
| 788 | EventEmitter.once = function(eventName, callback) { |
| 789 | var _self = this; |
| 790 | callback && this.addEventListener(eventName, function newCallback() { |
| 791 | _self.removeEventListener(eventName, newCallback); |
| 792 | callback.apply(null, arguments); |
| 793 | }); |
| 794 | }; |
| 795 | |
| 796 | |
| 797 | EventEmitter.setDefaultHandler = function(eventName, callback) { |
| 798 | var handlers = this._defaultHandlers; |
| 799 | if (!handlers) |
| 800 | handlers = this._defaultHandlers = {_disabled_: {}}; |
| 801 | |
| 802 | if (handlers[eventName]) { |
| 803 | var old = handlers[eventName]; |
| 804 | var disabled = handlers._disabled_[eventName]; |
| 805 | if (!disabled) |
| 806 | handlers._disabled_[eventName] = disabled = []; |
| 807 | disabled.push(old); |
| 808 | var i = disabled.indexOf(callback); |
| 809 | if (i != -1) |
| 810 | disabled.splice(i, 1); |
| 811 | } |
| 812 | handlers[eventName] = callback; |
| 813 | }; |
| 814 | EventEmitter.removeDefaultHandler = function(eventName, callback) { |
| 815 | var handlers = this._defaultHandlers; |
| 816 | if (!handlers) |
| 817 | return; |
| 818 | var disabled = handlers._disabled_[eventName]; |
| 819 | |
| 820 | if (handlers[eventName] == callback) { |
| 821 | var old = handlers[eventName]; |
| 822 | if (disabled) |
| 823 | this.setDefaultHandler(eventName, disabled.pop()); |
| 824 | } else if (disabled) { |
| 825 | var i = disabled.indexOf(callback); |
| 826 | if (i != -1) |
| 827 | disabled.splice(i, 1); |
| 828 | } |
| 829 | }; |
| 830 | |
| 831 | EventEmitter.on = |
| 832 | EventEmitter.addEventListener = function(eventName, callback, capturing) { |
| 833 | this._eventRegistry = this._eventRegistry || {}; |
| 834 | |
| 835 | var listeners = this._eventRegistry[eventName]; |
| 836 | if (!listeners) |
| 837 | listeners = this._eventRegistry[eventName] = []; |
| 838 | |
| 839 | if (listeners.indexOf(callback) == -1) |
| 840 | listeners[capturing ? "unshift" : "push"](callback); |
| 841 | return callback; |
| 842 | }; |
| 843 | |
| 844 | EventEmitter.off = |
| 845 | EventEmitter.removeListener = |
| 846 | EventEmitter.removeEventListener = function(eventName, callback) { |
| 847 | this._eventRegistry = this._eventRegistry || {}; |
| 848 | |
| 849 | var listeners = this._eventRegistry[eventName]; |
| 850 | if (!listeners) |
| 851 | return; |
| 852 | |
| 853 | var index = listeners.indexOf(callback); |
| 854 | if (index !== -1) |
| 855 | listeners.splice(index, 1); |
| 856 | }; |
| 857 | |
| 858 | EventEmitter.removeAllListeners = function(eventName) { |
| 859 | if (this._eventRegistry) this._eventRegistry[eventName] = []; |
| 860 | }; |
| 861 | |
| 862 | exports.EventEmitter = EventEmitter; |
| 863 | |
| 864 | }); |
| 865 | |
| 866 | define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"], function(require, exports, module) { |
| 867 | "use strict"; |
| 868 | |
| 869 | var oop = require("./lib/oop"); |
| 870 | var EventEmitter = require("./lib/event_emitter").EventEmitter; |
| 871 | |
| 872 | var Anchor = exports.Anchor = function(doc, row, column) { |
| 873 | this.$onChange = this.onChange.bind(this); |
| 874 | this.attach(doc); |
| 875 | |
| 876 | if (typeof column == "undefined") |
| 877 | this.setPosition(row.row, row.column); |
| 878 | else |
| 879 | this.setPosition(row, column); |
| 880 | }; |
| 881 | |
| 882 | (function() { |
| 883 | |
| 884 | oop.implement(this, EventEmitter); |
| 885 | this.getPosition = function() { |
| 886 | return this.$clipPositionToDocument(this.row, this.column); |
| 887 | }; |
| 888 | this.getDocument = function() { |
| 889 | return this.document; |
| 890 | }; |
| 891 | this.$insertRight = false; |
| 892 | this.onChange = function(delta) { |
| 893 | if (delta.start.row == delta.end.row && delta.start.row != this.row) |
| 894 | return; |
| 895 | |
| 896 | if (delta.start.row > this.row) |
| 897 | return; |
| 898 | |
| 899 | var point = $getTransformedPoint(delta, {row: this.row, column: this.column}, this.$insertRight); |
| 900 | this.setPosition(point.row, point.column, true); |
| 901 | }; |
| 902 | |
| 903 | function $pointsInOrder(point1, point2, equalPointsInOrder) { |
| 904 | var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column; |
| 905 | return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter); |
| 906 | } |
| 907 | |
| 908 | function $getTransformedPoint(delta, point, moveIfEqual) { |
| 909 | var deltaIsInsert = delta.action == "insert"; |
| 910 | var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row); |
| 911 | var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column); |
| 912 | var deltaStart = delta.start; |
| 913 | var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range. |
| 914 | if ($pointsInOrder(point, deltaStart, moveIfEqual)) { |
| 915 | return { |
| 916 | row: point.row, |
| 917 | column: point.column |
| 918 | }; |
| 919 | } |
| 920 | if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) { |
| 921 | return { |
| 922 | row: point.row + deltaRowShift, |
| 923 | column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0) |
| 924 | }; |
| 925 | } |
| 926 | |
| 927 | return { |
| 928 | row: deltaStart.row, |
| 929 | column: deltaStart.column |
| 930 | }; |
| 931 | } |
| 932 | this.setPosition = function(row, column, noClip) { |
| 933 | var pos; |
| 934 | if (noClip) { |
| 935 | pos = { |
| 936 | row: row, |
| 937 | column: column |
| 938 | }; |
| 939 | } else { |
| 940 | pos = this.$clipPositionToDocument(row, column); |
| 941 | } |
| 942 | |
| 943 | if (this.row == pos.row && this.column == pos.column) |
| 944 | return; |
| 945 | |
| 946 | var old = { |
| 947 | row: this.row, |
| 948 | column: this.column |
| 949 | }; |
| 950 | |
| 951 | this.row = pos.row; |
| 952 | this.column = pos.column; |
| 953 | this._signal("change", { |
| 954 | old: old, |
| 955 | value: pos |
| 956 | }); |
| 957 | }; |
| 958 | this.detach = function() { |
| 959 | this.document.removeEventListener("change", this.$onChange); |
| 960 | }; |
| 961 | this.attach = function(doc) { |
| 962 | this.document = doc || this.document; |
| 963 | this.document.on("change", this.$onChange); |
| 964 | }; |
| 965 | this.$clipPositionToDocument = function(row, column) { |
| 966 | var pos = {}; |
| 967 | |
| 968 | if (row >= this.document.getLength()) { |
| 969 | pos.row = Math.max(0, this.document.getLength() - 1); |
| 970 | pos.column = this.document.getLine(pos.row).length; |
| 971 | } |
| 972 | else if (row < 0) { |
| 973 | pos.row = 0; |
| 974 | pos.column = 0; |
| 975 | } |
| 976 | else { |
| 977 | pos.row = row; |
| 978 | pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column)); |
| 979 | } |
| 980 | |
| 981 | if (column < 0) |
| 982 | pos.column = 0; |
| 983 | |
| 984 | return pos; |
| 985 | }; |
| 986 | |
| 987 | }).call(Anchor.prototype); |
| 988 | |
| 989 | }); |
| 990 | |
| 991 | define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"], function(require, exports, module) { |
| 992 | "use strict"; |
| 993 | |
| 994 | var oop = require("./lib/oop"); |
| 995 | var applyDelta = require("./apply_delta").applyDelta; |
| 996 | var EventEmitter = require("./lib/event_emitter").EventEmitter; |
| 997 | var Range = require("./range").Range; |
| 998 | var Anchor = require("./anchor").Anchor; |
| 999 | |
| 1000 | var Document = function(textOrLines) { |
| 1001 | this.$lines = [""]; |
| 1002 | if (textOrLines.length === 0) { |
| 1003 | this.$lines = [""]; |
| 1004 | } else if (Array.isArray(textOrLines)) { |
| 1005 | this.insertMergedLines({row: 0, column: 0}, textOrLines); |
| 1006 | } else { |
| 1007 | this.insert({row: 0, column:0}, textOrLines); |
| 1008 | } |
| 1009 | }; |
| 1010 | |
| 1011 | (function() { |
| 1012 | |
| 1013 | oop.implement(this, EventEmitter); |
| 1014 | this.setValue = function(text) { |
| 1015 | var len = this.getLength() - 1; |
| 1016 | this.remove(new Range(0, 0, len, this.getLine(len).length)); |
| 1017 | this.insert({row: 0, column: 0}, text); |
| 1018 | }; |
| 1019 | this.getValue = function() { |
| 1020 | return this.getAllLines().join(this.getNewLineCharacter()); |
| 1021 | }; |
| 1022 | this.createAnchor = function(row, column) { |
| 1023 | return new Anchor(this, row, column); |
| 1024 | }; |
| 1025 | if ("aaa".split(/a/).length === 0) { |
| 1026 | this.$split = function(text) { |
| 1027 | return text.replace(/\r\n|\r/g, "\n").split("\n"); |
| 1028 | }; |
| 1029 | } else { |
| 1030 | this.$split = function(text) { |
| 1031 | return text.split(/\r\n|\r|\n/); |
| 1032 | }; |
| 1033 | } |
| 1034 | |
| 1035 | |
| 1036 | this.$detectNewLine = function(text) { |
| 1037 | var match = text.match(/^.*?(\r\n|\r|\n)/m); |
| 1038 | this.$autoNewLine = match ? match[1] : "\n"; |
| 1039 | this._signal("changeNewLineMode"); |
| 1040 | }; |
| 1041 | this.getNewLineCharacter = function() { |
| 1042 | switch (this.$newLineMode) { |
| 1043 | case "windows": |
| 1044 | return "\r\n"; |
| 1045 | case "unix": |
| 1046 | return "\n"; |
| 1047 | default: |
| 1048 | return this.$autoNewLine || "\n"; |
| 1049 | } |
| 1050 | }; |
| 1051 | |
| 1052 | this.$autoNewLine = ""; |
| 1053 | this.$newLineMode = "auto"; |
| 1054 | this.setNewLineMode = function(newLineMode) { |
| 1055 | if (this.$newLineMode === newLineMode) |
| 1056 | return; |
| 1057 | |
| 1058 | this.$newLineMode = newLineMode; |
| 1059 | this._signal("changeNewLineMode"); |
| 1060 | }; |
| 1061 | this.getNewLineMode = function() { |
| 1062 | return this.$newLineMode; |
| 1063 | }; |
| 1064 | this.isNewLine = function(text) { |
| 1065 | return (text == "\r\n" || text == "\r" || text == "\n"); |
| 1066 | }; |
| 1067 | this.getLine = function(row) { |
| 1068 | return this.$lines[row] || ""; |
| 1069 | }; |
| 1070 | this.getLines = function(firstRow, lastRow) { |
| 1071 | return this.$lines.slice(firstRow, lastRow + 1); |
| 1072 | }; |
| 1073 | this.getAllLines = function() { |
| 1074 | return this.getLines(0, this.getLength()); |
| 1075 | }; |
| 1076 | this.getLength = function() { |
| 1077 | return this.$lines.length; |
| 1078 | }; |
| 1079 | this.getTextRange = function(range) { |
| 1080 | return this.getLinesForRange(range).join(this.getNewLineCharacter()); |
| 1081 | }; |
| 1082 | this.getLinesForRange = function(range) { |
| 1083 | var lines; |
| 1084 | if (range.start.row === range.end.row) { |
| 1085 | lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)]; |
| 1086 | } else { |
| 1087 | lines = this.getLines(range.start.row, range.end.row); |
| 1088 | lines[0] = (lines[0] || "").substring(range.start.column); |
| 1089 | var l = lines.length - 1; |
| 1090 | if (range.end.row - range.start.row == l) |
| 1091 | lines[l] = lines[l].substring(0, range.end.column); |
| 1092 | } |
| 1093 | return lines; |
| 1094 | }; |
| 1095 | this.insertLines = function(row, lines) { |
| 1096 | console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."); |
| 1097 | return this.insertFullLines(row, lines); |
| 1098 | }; |
| 1099 | this.removeLines = function(firstRow, lastRow) { |
| 1100 | console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."); |
| 1101 | return this.removeFullLines(firstRow, lastRow); |
| 1102 | }; |
| 1103 | this.insertNewLine = function(position) { |
| 1104 | console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."); |
| 1105 | return this.insertMergedLines(position, ["", ""]); |
| 1106 | }; |
| 1107 | this.insert = function(position, text) { |
| 1108 | if (this.getLength() <= 1) |
| 1109 | this.$detectNewLine(text); |
| 1110 | |
| 1111 | return this.insertMergedLines(position, this.$split(text)); |
| 1112 | }; |
| 1113 | this.insertInLine = function(position, text) { |
| 1114 | var start = this.clippedPos(position.row, position.column); |
| 1115 | var end = this.pos(position.row, position.column + text.length); |
| 1116 | |
| 1117 | this.applyDelta({ |
| 1118 | start: start, |
| 1119 | end: end, |
| 1120 | action: "insert", |
| 1121 | lines: [text] |
| 1122 | }, true); |
| 1123 | |
| 1124 | return this.clonePos(end); |
| 1125 | }; |
| 1126 | |
| 1127 | this.clippedPos = function(row, column) { |
| 1128 | var length = this.getLength(); |
| 1129 | if (row === undefined) { |
| 1130 | row = length; |
| 1131 | } else if (row < 0) { |
| 1132 | row = 0; |
| 1133 | } else if (row >= length) { |
| 1134 | row = length - 1; |
| 1135 | column = undefined; |
| 1136 | } |
| 1137 | var line = this.getLine(row); |
| 1138 | if (column == undefined) |
| 1139 | column = line.length; |
| 1140 | column = Math.min(Math.max(column, 0), line.length); |
| 1141 | return {row: row, column: column}; |
| 1142 | }; |
| 1143 | |
| 1144 | this.clonePos = function(pos) { |
| 1145 | return {row: pos.row, column: pos.column}; |
| 1146 | }; |
| 1147 | |
| 1148 | this.pos = function(row, column) { |
| 1149 | return {row: row, column: column}; |
| 1150 | }; |
| 1151 | |
| 1152 | this.$clipPosition = function(position) { |
| 1153 | var length = this.getLength(); |
| 1154 | if (position.row >= length) { |
| 1155 | position.row = Math.max(0, length - 1); |
| 1156 | position.column = this.getLine(length - 1).length; |
| 1157 | } else { |
| 1158 | position.row = Math.max(0, position.row); |
| 1159 | position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length); |
| 1160 | } |
| 1161 | return position; |
| 1162 | }; |
| 1163 | this.insertFullLines = function(row, lines) { |
| 1164 | row = Math.min(Math.max(row, 0), this.getLength()); |
| 1165 | var column = 0; |
| 1166 | if (row < this.getLength()) { |
| 1167 | lines = lines.concat([""]); |
| 1168 | column = 0; |
| 1169 | } else { |
| 1170 | lines = [""].concat(lines); |
| 1171 | row--; |
| 1172 | column = this.$lines[row].length; |
| 1173 | } |
| 1174 | this.insertMergedLines({row: row, column: column}, lines); |
| 1175 | }; |
| 1176 | this.insertMergedLines = function(position, lines) { |
| 1177 | var start = this.clippedPos(position.row, position.column); |
| 1178 | var end = { |
| 1179 | row: start.row + lines.length - 1, |
| 1180 | column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length |
| 1181 | }; |
| 1182 | |
| 1183 | this.applyDelta({ |
| 1184 | start: start, |
| 1185 | end: end, |
| 1186 | action: "insert", |
| 1187 | lines: lines |
| 1188 | }); |
| 1189 | |
| 1190 | return this.clonePos(end); |
| 1191 | }; |
| 1192 | this.remove = function(range) { |
| 1193 | var start = this.clippedPos(range.start.row, range.start.column); |
| 1194 | var end = this.clippedPos(range.end.row, range.end.column); |
| 1195 | this.applyDelta({ |
| 1196 | start: start, |
| 1197 | end: end, |
| 1198 | action: "remove", |
| 1199 | lines: this.getLinesForRange({start: start, end: end}) |
| 1200 | }); |
| 1201 | return this.clonePos(start); |
| 1202 | }; |
| 1203 | this.removeInLine = function(row, startColumn, endColumn) { |
| 1204 | var start = this.clippedPos(row, startColumn); |
| 1205 | var end = this.clippedPos(row, endColumn); |
| 1206 | |
| 1207 | this.applyDelta({ |
| 1208 | start: start, |
| 1209 | end: end, |
| 1210 | action: "remove", |
| 1211 | lines: this.getLinesForRange({start: start, end: end}) |
| 1212 | }, true); |
| 1213 | |
| 1214 | return this.clonePos(start); |
| 1215 | }; |
| 1216 | this.removeFullLines = function(firstRow, lastRow) { |
| 1217 | firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1); |
| 1218 | lastRow = Math.min(Math.max(0, lastRow ), this.getLength() - 1); |
| 1219 | var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0; |
| 1220 | var deleteLastNewLine = lastRow < this.getLength() - 1; |
| 1221 | var startRow = ( deleteFirstNewLine ? firstRow - 1 : firstRow ); |
| 1222 | var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0 ); |
| 1223 | var endRow = ( deleteLastNewLine ? lastRow + 1 : lastRow ); |
| 1224 | var endCol = ( deleteLastNewLine ? 0 : this.getLine(endRow).length ); |
| 1225 | var range = new Range(startRow, startCol, endRow, endCol); |
| 1226 | var deletedLines = this.$lines.slice(firstRow, lastRow + 1); |
| 1227 | |
| 1228 | this.applyDelta({ |
| 1229 | start: range.start, |
| 1230 | end: range.end, |
| 1231 | action: "remove", |
| 1232 | lines: this.getLinesForRange(range) |
| 1233 | }); |
| 1234 | return deletedLines; |
| 1235 | }; |
| 1236 | this.removeNewLine = function(row) { |
| 1237 | if (row < this.getLength() - 1 && row >= 0) { |
| 1238 | this.applyDelta({ |
| 1239 | start: this.pos(row, this.getLine(row).length), |
| 1240 | end: this.pos(row + 1, 0), |
| 1241 | action: "remove", |
| 1242 | lines: ["", ""] |
| 1243 | }); |
| 1244 | } |
| 1245 | }; |
| 1246 | this.replace = function(range, text) { |
| 1247 | if (!(range instanceof Range)) |
| 1248 | range = Range.fromPoints(range.start, range.end); |
| 1249 | if (text.length === 0 && range.isEmpty()) |
| 1250 | return range.start; |
| 1251 | if (text == this.getTextRange(range)) |
| 1252 | return range.end; |
| 1253 | |
| 1254 | this.remove(range); |
| 1255 | var end; |
| 1256 | if (text) { |
| 1257 | end = this.insert(range.start, text); |
| 1258 | } |
| 1259 | else { |
| 1260 | end = range.start; |
| 1261 | } |
| 1262 | |
| 1263 | return end; |
| 1264 | }; |
| 1265 | this.applyDeltas = function(deltas) { |
| 1266 | for (var i=0; i<deltas.length; i++) { |
| 1267 | this.applyDelta(deltas[i]); |
| 1268 | } |
| 1269 | }; |
| 1270 | this.revertDeltas = function(deltas) { |
| 1271 | for (var i=deltas.length-1; i>=0; i--) { |
| 1272 | this.revertDelta(deltas[i]); |
| 1273 | } |
| 1274 | }; |
| 1275 | this.applyDelta = function(delta, doNotValidate) { |
| 1276 | var isInsert = delta.action == "insert"; |
| 1277 | if (isInsert ? delta.lines.length <= 1 && !delta.lines[0] |
| 1278 | : !Range.comparePoints(delta.start, delta.end)) { |
| 1279 | return; |
| 1280 | } |
| 1281 | |
| 1282 | if (isInsert && delta.lines.length > 20000) |
| 1283 | this.$splitAndapplyLargeDelta(delta, 20000); |
| 1284 | applyDelta(this.$lines, delta, doNotValidate); |
| 1285 | this._signal("change", delta); |
| 1286 | }; |
| 1287 | |
| 1288 | this.$splitAndapplyLargeDelta = function(delta, MAX) { |
| 1289 | var lines = delta.lines; |
| 1290 | var l = lines.length; |
| 1291 | var row = delta.start.row; |
| 1292 | var column = delta.start.column; |
| 1293 | var from = 0, to = 0; |
| 1294 | do { |
| 1295 | from = to; |
| 1296 | to += MAX - 1; |
| 1297 | var chunk = lines.slice(from, to); |
| 1298 | if (to > l) { |
| 1299 | delta.lines = chunk; |
| 1300 | delta.start.row = row + from; |
| 1301 | delta.start.column = column; |
| 1302 | break; |
| 1303 | } |
| 1304 | chunk.push(""); |
| 1305 | this.applyDelta({ |
| 1306 | start: this.pos(row + from, column), |
| 1307 | end: this.pos(row + to, column = 0), |
| 1308 | action: delta.action, |
| 1309 | lines: chunk |
| 1310 | }, true); |
| 1311 | } while(true); |
| 1312 | }; |
| 1313 | this.revertDelta = function(delta) { |
| 1314 | this.applyDelta({ |
| 1315 | start: this.clonePos(delta.start), |
| 1316 | end: this.clonePos(delta.end), |
| 1317 | action: (delta.action == "insert" ? "remove" : "insert"), |
| 1318 | lines: delta.lines.slice() |
| 1319 | }); |
| 1320 | }; |
| 1321 | this.indexToPosition = function(index, startRow) { |
| 1322 | var lines = this.$lines || this.getAllLines(); |
| 1323 | var newlineLength = this.getNewLineCharacter().length; |
| 1324 | for (var i = startRow || 0, l = lines.length; i < l; i++) { |
| 1325 | index -= lines[i].length + newlineLength; |
| 1326 | if (index < 0) |
| 1327 | return {row: i, column: index + lines[i].length + newlineLength}; |
| 1328 | } |
| 1329 | return {row: l-1, column: lines[l-1].length}; |
| 1330 | }; |
| 1331 | this.positionToIndex = function(pos, startRow) { |
| 1332 | var lines = this.$lines || this.getAllLines(); |
| 1333 | var newlineLength = this.getNewLineCharacter().length; |
| 1334 | var index = 0; |
| 1335 | var row = Math.min(pos.row, lines.length); |
| 1336 | for (var i = startRow || 0; i < row; ++i) |
| 1337 | index += lines[i].length + newlineLength; |
| 1338 | |
| 1339 | return index + pos.column; |
| 1340 | }; |
| 1341 | |
| 1342 | }).call(Document.prototype); |
| 1343 | |
| 1344 | exports.Document = Document; |
| 1345 | }); |
| 1346 | |
| 1347 | define("ace/worker/mirror",["require","exports","module","ace/range","ace/document","ace/lib/lang"], function(require, exports, module) { |
| 1348 | "use strict"; |
| 1349 | |
| 1350 | var Range = require("../range").Range; |
| 1351 | var Document = require("../document").Document; |
| 1352 | var lang = require("../lib/lang"); |
| 1353 | |
| 1354 | var Mirror = exports.Mirror = function(sender) { |
| 1355 | this.sender = sender; |
| 1356 | var doc = this.doc = new Document(""); |
| 1357 | |
| 1358 | var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this)); |
| 1359 | |
| 1360 | var _self = this; |
| 1361 | sender.on("change", function(e) { |
| 1362 | var data = e.data; |
| 1363 | if (data[0].start) { |
| 1364 | doc.applyDeltas(data); |
| 1365 | } else { |
| 1366 | for (var i = 0; i < data.length; i += 2) { |
| 1367 | if (Array.isArray(data[i+1])) { |
| 1368 | var d = {action: "insert", start: data[i], lines: data[i+1]}; |
| 1369 | } else { |
| 1370 | var d = {action: "remove", start: data[i], end: data[i+1]}; |
| 1371 | } |
| 1372 | doc.applyDelta(d, true); |
| 1373 | } |
| 1374 | } |
| 1375 | if (_self.$timeout) |
| 1376 | return deferredUpdate.schedule(_self.$timeout); |
| 1377 | _self.onUpdate(); |
| 1378 | }); |
| 1379 | }; |
| 1380 | |
| 1381 | (function() { |
| 1382 | |
| 1383 | this.$timeout = 500; |
| 1384 | |
| 1385 | this.setTimeout = function(timeout) { |
| 1386 | this.$timeout = timeout; |
| 1387 | }; |
| 1388 | |
| 1389 | this.setValue = function(value) { |
| 1390 | this.doc.setValue(value); |
| 1391 | this.deferredUpdate.schedule(this.$timeout); |
| 1392 | }; |
| 1393 | |
| 1394 | this.getValue = function(callbackId) { |
| 1395 | this.sender.callback(this.doc.getValue(), callbackId); |
| 1396 | }; |
| 1397 | |
| 1398 | this.onUpdate = function() { |
| 1399 | }; |
| 1400 | |
| 1401 | this.isPending = function() { |
| 1402 | return this.deferredUpdate.isPending(); |
| 1403 | }; |
| 1404 | |
| 1405 | }).call(Mirror.prototype); |
| 1406 | |
| 1407 | }); |
| 1408 | |
| 1409 | define("ace/mode/html/saxparser",["require","exports","module"], function(require, exports, module) { |
| 1410 | module.exports = (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({ |
| 1411 | 1:[function(_dereq_,module,exports){ |
| 1412 | function isScopeMarker(node) { |
| 1413 | if (node.namespaceURI === "http://www.w3.org/1999/xhtml") { |
| 1414 | return node.localName === "applet" |
| 1415 | || node.localName === "caption" |
| 1416 | || node.localName === "marquee" |
| 1417 | || node.localName === "object" |
| 1418 | || node.localName === "table" |
| 1419 | || node.localName === "td" |
| 1420 | || node.localName === "th"; |
| 1421 | } |
| 1422 | if (node.namespaceURI === "http://www.w3.org/1998/Math/MathML") { |
| 1423 | return node.localName === "mi" |
| 1424 | || node.localName === "mo" |
| 1425 | || node.localName === "mn" |
| 1426 | || node.localName === "ms" |
| 1427 | || node.localName === "mtext" |
| 1428 | || node.localName === "annotation-xml"; |
| 1429 | } |
| 1430 | if (node.namespaceURI === "http://www.w3.org/2000/svg") { |
| 1431 | return node.localName === "foreignObject" |
| 1432 | || node.localName === "desc" |
| 1433 | || node.localName === "title"; |
| 1434 | } |
| 1435 | } |
| 1436 | |
| 1437 | function isListItemScopeMarker(node) { |
| 1438 | return isScopeMarker(node) |
| 1439 | || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'ol') |
| 1440 | || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'ul'); |
| 1441 | } |
| 1442 | |
| 1443 | function isTableScopeMarker(node) { |
| 1444 | return (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'table') |
| 1445 | || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'html'); |
| 1446 | } |
| 1447 | |
| 1448 | function isTableBodyScopeMarker(node) { |
| 1449 | return (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'tbody') |
| 1450 | || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'tfoot') |
| 1451 | || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'thead') |
| 1452 | || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'html'); |
| 1453 | } |
| 1454 | |
| 1455 | function isTableRowScopeMarker(node) { |
| 1456 | return (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'tr') |
| 1457 | || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'html'); |
| 1458 | } |
| 1459 | |
| 1460 | function isButtonScopeMarker(node) { |
| 1461 | return isScopeMarker(node) |
| 1462 | || (node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'button'); |
| 1463 | } |
| 1464 | |
| 1465 | function isSelectScopeMarker(node) { |
| 1466 | return !(node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'optgroup') |
| 1467 | && !(node.namespaceURI === "http://www.w3.org/1999/xhtml" && node.localName === 'option'); |
| 1468 | } |
| 1469 | function ElementStack() { |
| 1470 | this.elements = []; |
| 1471 | this.rootNode = null; |
| 1472 | this.headElement = null; |
| 1473 | this.bodyElement = null; |
| 1474 | } |
| 1475 | ElementStack.prototype._inScope = function(localName, isMarker) { |
| 1476 | for (var i = this.elements.length - 1; i >= 0; i--) { |
| 1477 | var node = this.elements[i]; |
| 1478 | if (node.localName === localName) |
| 1479 | return true; |
| 1480 | if (isMarker(node)) |
| 1481 | return false; |
| 1482 | } |
| 1483 | }; |
| 1484 | ElementStack.prototype.push = function(item) { |
| 1485 | this.elements.push(item); |
| 1486 | }; |
| 1487 | ElementStack.prototype.pushHtmlElement = function(item) { |
| 1488 | this.rootNode = item.node; |
| 1489 | this.push(item); |
| 1490 | }; |
| 1491 | ElementStack.prototype.pushHeadElement = function(item) { |
| 1492 | this.headElement = item.node; |
| 1493 | this.push(item); |
| 1494 | }; |
| 1495 | ElementStack.prototype.pushBodyElement = function(item) { |
| 1496 | this.bodyElement = item.node; |
| 1497 | this.push(item); |
| 1498 | }; |
| 1499 | ElementStack.prototype.pop = function() { |
| 1500 | return this.elements.pop(); |
| 1501 | }; |
| 1502 | ElementStack.prototype.remove = function(item) { |
| 1503 | this.elements.splice(this.elements.indexOf(item), 1); |
| 1504 | }; |
| 1505 | ElementStack.prototype.popUntilPopped = function(localName) { |
| 1506 | var element; |
| 1507 | do { |
| 1508 | element = this.pop(); |
| 1509 | } while (element.localName != localName); |
| 1510 | }; |
| 1511 | |
| 1512 | ElementStack.prototype.popUntilTableScopeMarker = function() { |
| 1513 | while (!isTableScopeMarker(this.top)) |
| 1514 | this.pop(); |
| 1515 | }; |
| 1516 | |
| 1517 | ElementStack.prototype.popUntilTableBodyScopeMarker = function() { |
| 1518 | while (!isTableBodyScopeMarker(this.top)) |
| 1519 | this.pop(); |
| 1520 | }; |
| 1521 | |
| 1522 | ElementStack.prototype.popUntilTableRowScopeMarker = function() { |
| 1523 | while (!isTableRowScopeMarker(this.top)) |
| 1524 | this.pop(); |
| 1525 | }; |
| 1526 | ElementStack.prototype.item = function(index) { |
| 1527 | return this.elements[index]; |
| 1528 | }; |
| 1529 | ElementStack.prototype.contains = function(element) { |
| 1530 | return this.elements.indexOf(element) !== -1; |
| 1531 | }; |
| 1532 | ElementStack.prototype.inScope = function(localName) { |
| 1533 | return this._inScope(localName, isScopeMarker); |
| 1534 | }; |
| 1535 | ElementStack.prototype.inListItemScope = function(localName) { |
| 1536 | return this._inScope(localName, isListItemScopeMarker); |
| 1537 | }; |
| 1538 | ElementStack.prototype.inTableScope = function(localName) { |
| 1539 | return this._inScope(localName, isTableScopeMarker); |
| 1540 | }; |
| 1541 | ElementStack.prototype.inButtonScope = function(localName) { |
| 1542 | return this._inScope(localName, isButtonScopeMarker); |
| 1543 | }; |
| 1544 | ElementStack.prototype.inSelectScope = function(localName) { |
| 1545 | return this._inScope(localName, isSelectScopeMarker); |
| 1546 | }; |
| 1547 | ElementStack.prototype.hasNumberedHeaderElementInScope = function() { |
| 1548 | for (var i = this.elements.length - 1; i >= 0; i--) { |
| 1549 | var node = this.elements[i]; |
| 1550 | if (node.isNumberedHeader()) |
| 1551 | return true; |
| 1552 | if (isScopeMarker(node)) |
| 1553 | return false; |
| 1554 | } |
| 1555 | }; |
| 1556 | ElementStack.prototype.furthestBlockForFormattingElement = function(element) { |
| 1557 | var furthestBlock = null; |
| 1558 | for (var i = this.elements.length - 1; i >= 0; i--) { |
| 1559 | var node = this.elements[i]; |
| 1560 | if (node.node === element) |
| 1561 | break; |
| 1562 | if (node.isSpecial()) |
| 1563 | furthestBlock = node; |
| 1564 | } |
| 1565 | return furthestBlock; |
| 1566 | }; |
| 1567 | ElementStack.prototype.findIndex = function(localName) { |
| 1568 | for (var i = this.elements.length - 1; i >= 0; i--) { |
| 1569 | if (this.elements[i].localName == localName) |
| 1570 | return i; |
| 1571 | } |
| 1572 | return -1; |
| 1573 | }; |
| 1574 | |
| 1575 | ElementStack.prototype.remove_openElements_until = function(callback) { |
| 1576 | var finished = false; |
| 1577 | var element; |
| 1578 | while (!finished) { |
| 1579 | element = this.elements.pop(); |
| 1580 | finished = callback(element); |
| 1581 | } |
| 1582 | return element; |
| 1583 | }; |
| 1584 | |
| 1585 | Object.defineProperty(ElementStack.prototype, 'top', { |
| 1586 | get: function() { |
| 1587 | return this.elements[this.elements.length - 1]; |
| 1588 | } |
| 1589 | }); |
| 1590 | |
| 1591 | Object.defineProperty(ElementStack.prototype, 'length', { |
| 1592 | get: function() { |
| 1593 | return this.elements.length; |
| 1594 | } |
| 1595 | }); |
| 1596 | |
| 1597 | exports.ElementStack = ElementStack; |
| 1598 | |
| 1599 | }, |
| 1600 | {}], |
| 1601 | 2:[function(_dereq_,module,exports){ |
| 1602 | var entities = _dereq_('html5-entities'); |
| 1603 | var InputStream = _dereq_('./InputStream').InputStream; |
| 1604 | |
| 1605 | var namedEntityPrefixes = {}; |
| 1606 | Object.keys(entities).forEach(function (entityKey) { |
| 1607 | for (var i = 0; i < entityKey.length; i++) { |
| 1608 | namedEntityPrefixes[entityKey.substring(0, i + 1)] = true; |
| 1609 | } |
| 1610 | }); |
| 1611 | |
| 1612 | function isAlphaNumeric(c) { |
| 1613 | return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); |
| 1614 | } |
| 1615 | |
| 1616 | function isHexDigit(c) { |
| 1617 | return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); |
| 1618 | } |
| 1619 | |
| 1620 | function isDecimalDigit(c) { |
| 1621 | return (c >= '0' && c <= '9'); |
| 1622 | } |
| 1623 | |
| 1624 | var EntityParser = {}; |
| 1625 | |
| 1626 | EntityParser.consumeEntity = function(buffer, tokenizer, additionalAllowedCharacter) { |
| 1627 | var decodedCharacter = ''; |
| 1628 | var consumedCharacters = ''; |
| 1629 | var ch = buffer.char(); |
| 1630 | if (ch === InputStream.EOF) |
| 1631 | return false; |
| 1632 | consumedCharacters += ch; |
| 1633 | if (ch == '\t' || ch == '\n' || ch == '\v' || ch == ' ' || ch == '<' || ch == '&') { |
| 1634 | buffer.unget(consumedCharacters); |
| 1635 | return false; |
| 1636 | } |
| 1637 | if (additionalAllowedCharacter === ch) { |
| 1638 | buffer.unget(consumedCharacters); |
| 1639 | return false; |
| 1640 | } |
| 1641 | if (ch == '#') { |
| 1642 | ch = buffer.shift(1); |
| 1643 | if (ch === InputStream.EOF) { |
| 1644 | tokenizer._parseError("expected-numeric-entity-but-got-eof"); |
| 1645 | buffer.unget(consumedCharacters); |
| 1646 | return false; |
| 1647 | } |
| 1648 | consumedCharacters += ch; |
| 1649 | var radix = 10; |
| 1650 | var isDigit = isDecimalDigit; |
| 1651 | if (ch == 'x' || ch == 'X') { |
| 1652 | radix = 16; |
| 1653 | isDigit = isHexDigit; |
| 1654 | ch = buffer.shift(1); |
| 1655 | if (ch === InputStream.EOF) { |
| 1656 | tokenizer._parseError("expected-numeric-entity-but-got-eof"); |
| 1657 | buffer.unget(consumedCharacters); |
| 1658 | return false; |
| 1659 | } |
| 1660 | consumedCharacters += ch; |
| 1661 | } |
| 1662 | if (isDigit(ch)) { |
| 1663 | var code = ''; |
| 1664 | while (ch !== InputStream.EOF && isDigit(ch)) { |
| 1665 | code += ch; |
| 1666 | ch = buffer.char(); |
| 1667 | } |
| 1668 | code = parseInt(code, radix); |
| 1669 | var replacement = this.replaceEntityNumbers(code); |
| 1670 | if (replacement) { |
| 1671 | tokenizer._parseError("invalid-numeric-entity-replaced"); |
| 1672 | code = replacement; |
| 1673 | } |
| 1674 | if (code > 0xFFFF && code <= 0x10FFFF) { |
| 1675 | code -= 0x10000; |
| 1676 | var first = ((0xffc00 & code) >> 10) + 0xD800; |
| 1677 | var second = (0x3ff & code) + 0xDC00; |
| 1678 | decodedCharacter = String.fromCharCode(first, second); |
| 1679 | } else |
| 1680 | decodedCharacter = String.fromCharCode(code); |
| 1681 | if (ch !== ';') { |
| 1682 | tokenizer._parseError("numeric-entity-without-semicolon"); |
| 1683 | buffer.unget(ch); |
| 1684 | } |
| 1685 | return decodedCharacter; |
| 1686 | } |
| 1687 | buffer.unget(consumedCharacters); |
| 1688 | tokenizer._parseError("expected-numeric-entity"); |
| 1689 | return false; |
| 1690 | } |
| 1691 | if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) { |
| 1692 | var mostRecentMatch = ''; |
| 1693 | while (namedEntityPrefixes[consumedCharacters]) { |
| 1694 | if (entities[consumedCharacters]) { |
| 1695 | mostRecentMatch = consumedCharacters; |
| 1696 | } |
| 1697 | if (ch == ';') |
| 1698 | break; |
| 1699 | ch = buffer.char(); |
| 1700 | if (ch === InputStream.EOF) |
| 1701 | break; |
| 1702 | consumedCharacters += ch; |
| 1703 | } |
| 1704 | if (!mostRecentMatch) { |
| 1705 | tokenizer._parseError("expected-named-entity"); |
| 1706 | buffer.unget(consumedCharacters); |
| 1707 | return false; |
| 1708 | } |
| 1709 | decodedCharacter = entities[mostRecentMatch]; |
| 1710 | if (ch === ';' || !additionalAllowedCharacter || !(isAlphaNumeric(ch) || ch === '=')) { |
| 1711 | if (consumedCharacters.length > mostRecentMatch.length) { |
| 1712 | buffer.unget(consumedCharacters.substring(mostRecentMatch.length)); |
| 1713 | } |
| 1714 | if (ch !== ';') { |
| 1715 | tokenizer._parseError("named-entity-without-semicolon"); |
| 1716 | } |
| 1717 | return decodedCharacter; |
| 1718 | } |
| 1719 | buffer.unget(consumedCharacters); |
| 1720 | return false; |
| 1721 | } |
| 1722 | }; |
| 1723 | |
| 1724 | EntityParser.replaceEntityNumbers = function(c) { |
| 1725 | switch(c) { |
| 1726 | case 0x00: return 0xFFFD; // REPLACEMENT CHARACTER |
| 1727 | case 0x13: return 0x0010; // Carriage return |
| 1728 | case 0x80: return 0x20AC; // EURO SIGN |
| 1729 | case 0x81: return 0x0081; // <control> |
| 1730 | case 0x82: return 0x201A; // SINGLE LOW-9 QUOTATION MARK |
| 1731 | case 0x83: return 0x0192; // LATIN SMALL LETTER F WITH HOOK |
| 1732 | case 0x84: return 0x201E; // DOUBLE LOW-9 QUOTATION MARK |
| 1733 | case 0x85: return 0x2026; // HORIZONTAL ELLIPSIS |
| 1734 | case 0x86: return 0x2020; // DAGGER |
| 1735 | case 0x87: return 0x2021; // DOUBLE DAGGER |
| 1736 | case 0x88: return 0x02C6; // MODIFIER LETTER CIRCUMFLEX ACCENT |
| 1737 | case 0x89: return 0x2030; // PER MILLE SIGN |
| 1738 | case 0x8A: return 0x0160; // LATIN CAPITAL LETTER S WITH CARON |
| 1739 | case 0x8B: return 0x2039; // SINGLE LEFT-POINTING ANGLE QUOTATION MARK |
| 1740 | case 0x8C: return 0x0152; // LATIN CAPITAL LIGATURE OE |
| 1741 | case 0x8D: return 0x008D; // <control> |
| 1742 | case 0x8E: return 0x017D; // LATIN CAPITAL LETTER Z WITH CARON |
| 1743 | case 0x8F: return 0x008F; // <control> |
| 1744 | case 0x90: return 0x0090; // <control> |
| 1745 | case 0x91: return 0x2018; // LEFT SINGLE QUOTATION MARK |
| 1746 | case 0x92: return 0x2019; // RIGHT SINGLE QUOTATION MARK |
| 1747 | case 0x93: return 0x201C; // LEFT DOUBLE QUOTATION MARK |
| 1748 | case 0x94: return 0x201D; // RIGHT DOUBLE QUOTATION MARK |
| 1749 | case 0x95: return 0x2022; // BULLET |
| 1750 | case 0x96: return 0x2013; // EN DASH |
| 1751 | case 0x97: return 0x2014; // EM DASH |
| 1752 | case 0x98: return 0x02DC; // SMALL TILDE |
| 1753 | case 0x99: return 0x2122; // TRADE MARK SIGN |
| 1754 | case 0x9A: return 0x0161; // LATIN SMALL LETTER S WITH CARON |
| 1755 | case 0x9B: return 0x203A; // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK |
| 1756 | case 0x9C: return 0x0153; // LATIN SMALL LIGATURE OE |
| 1757 | case 0x9D: return 0x009D; // <control> |
| 1758 | case 0x9E: return 0x017E; // LATIN SMALL LETTER Z WITH CARON |
| 1759 | case 0x9F: return 0x0178; // LATIN CAPITAL LETTER Y WITH DIAERESIS |
| 1760 | default: |
| 1761 | if ((c >= 0xD800 && c <= 0xDFFF) || c > 0x10FFFF) { |
| 1762 | return 0xFFFD; |
| 1763 | } else if ((c >= 0x0001 && c <= 0x0008) || (c >= 0x000E && c <= 0x001F) || |
| 1764 | (c >= 0x007F && c <= 0x009F) || (c >= 0xFDD0 && c <= 0xFDEF) || |
| 1765 | c == 0x000B || c == 0xFFFE || c == 0x1FFFE || c == 0x2FFFFE || |
| 1766 | c == 0x2FFFF || c == 0x3FFFE || c == 0x3FFFF || c == 0x4FFFE || |
| 1767 | c == 0x4FFFF || c == 0x5FFFE || c == 0x5FFFF || c == 0x6FFFE || |
| 1768 | c == 0x6FFFF || c == 0x7FFFE || c == 0x7FFFF || c == 0x8FFFE || |
| 1769 | c == 0x8FFFF || c == 0x9FFFE || c == 0x9FFFF || c == 0xAFFFE || |
| 1770 | c == 0xAFFFF || c == 0xBFFFE || c == 0xBFFFF || c == 0xCFFFE || |
| 1771 | c == 0xCFFFF || c == 0xDFFFE || c == 0xDFFFF || c == 0xEFFFE || |
| 1772 | c == 0xEFFFF || c == 0xFFFFE || c == 0xFFFFF || c == 0x10FFFE || |
| 1773 | c == 0x10FFFF) { |
| 1774 | return c; |
| 1775 | } |
| 1776 | } |
| 1777 | }; |
| 1778 | |
| 1779 | exports.EntityParser = EntityParser; |
| 1780 | |
| 1781 | }, |
| 1782 | {"./InputStream":3,"html5-entities":12}], |
| 1783 | 3:[function(_dereq_,module,exports){ |
| 1784 | function InputStream() { |
| 1785 | this.data = ''; |
| 1786 | this.start = 0; |
| 1787 | this.committed = 0; |
| 1788 | this.eof = false; |
| 1789 | this.lastLocation = {line: 0, column: 0}; |
| 1790 | } |
| 1791 | |
| 1792 | InputStream.EOF = -1; |
| 1793 | |
| 1794 | InputStream.DRAIN = -2; |
| 1795 | |
| 1796 | InputStream.prototype = { |
| 1797 | slice: function() { |
| 1798 | if(this.start >= this.data.length) { |
| 1799 | if(!this.eof) throw InputStream.DRAIN; |
| 1800 | return InputStream.EOF; |
| 1801 | } |
| 1802 | return this.data.slice(this.start, this.data.length); |
| 1803 | }, |
| 1804 | char: function() { |
| 1805 | if(!this.eof && this.start >= this.data.length - 1) throw InputStream.DRAIN; |
| 1806 | if(this.start >= this.data.length) { |
| 1807 | return InputStream.EOF; |
| 1808 | } |
| 1809 | var ch = this.data[this.start++]; |
| 1810 | if (ch === '\r') |
| 1811 | ch = '\n'; |
| 1812 | return ch; |
| 1813 | }, |
| 1814 | advance: function(amount) { |
| 1815 | this.start += amount; |
| 1816 | if(this.start >= this.data.length) { |
| 1817 | if(!this.eof) throw InputStream.DRAIN; |
| 1818 | return InputStream.EOF; |
| 1819 | } else { |
| 1820 | if(this.committed > this.data.length / 2) { |
| 1821 | this.lastLocation = this.location(); |
| 1822 | this.data = this.data.slice(this.committed); |
| 1823 | this.start = this.start - this.committed; |
| 1824 | this.committed = 0; |
| 1825 | } |
| 1826 | } |
| 1827 | }, |
| 1828 | matchWhile: function(re) { |
| 1829 | if(this.eof && this.start >= this.data.length ) return ''; |
| 1830 | var r = new RegExp("^"+re+"+"); |
| 1831 | var m = r.exec(this.slice()); |
| 1832 | if(m) { |
| 1833 | if(!this.eof && m[0].length == this.data.length - this.start) throw InputStream.DRAIN; |
| 1834 | this.advance(m[0].length); |
| 1835 | return m[0]; |
| 1836 | } else { |
| 1837 | return ''; |
| 1838 | } |
| 1839 | }, |
| 1840 | matchUntil: function(re) { |
| 1841 | var m, s; |
| 1842 | s = this.slice(); |
| 1843 | if(s === InputStream.EOF) { |
| 1844 | return ''; |
| 1845 | } else if(m = new RegExp(re + (this.eof ? "|$" : "")).exec(s)) { |
| 1846 | var t = this.data.slice(this.start, this.start + m.index); |
| 1847 | this.advance(m.index); |
| 1848 | return t.replace(/\r/g, '\n').replace(/\n{2,}/g, '\n'); |
| 1849 | } else { |
| 1850 | throw InputStream.DRAIN; |
| 1851 | } |
| 1852 | }, |
| 1853 | append: function(data) { |
| 1854 | this.data += data; |
| 1855 | }, |
| 1856 | shift: function(n) { |
| 1857 | if(!this.eof && this.start + n >= this.data.length) throw InputStream.DRAIN; |
| 1858 | if(this.eof && this.start >= this.data.length) return InputStream.EOF; |
| 1859 | var d = this.data.slice(this.start, this.start + n).toString(); |
| 1860 | this.advance(Math.min(n, this.data.length - this.start)); |
| 1861 | return d; |
| 1862 | }, |
| 1863 | peek: function(n) { |
| 1864 | if(!this.eof && this.start + n >= this.data.length) throw InputStream.DRAIN; |
| 1865 | if(this.eof && this.start >= this.data.length) return InputStream.EOF; |
| 1866 | return this.data.slice(this.start, Math.min(this.start + n, this.data.length)).toString(); |
| 1867 | }, |
| 1868 | length: function() { |
| 1869 | return this.data.length - this.start - 1; |
| 1870 | }, |
| 1871 | unget: function(d) { |
| 1872 | if(d === InputStream.EOF) return; |
| 1873 | this.start -= (d.length); |
| 1874 | }, |
| 1875 | undo: function() { |
| 1876 | this.start = this.committed; |
| 1877 | }, |
| 1878 | commit: function() { |
| 1879 | this.committed = this.start; |
| 1880 | }, |
| 1881 | location: function() { |
| 1882 | var lastLine = this.lastLocation.line; |
| 1883 | var lastColumn = this.lastLocation.column; |
| 1884 | var read = this.data.slice(0, this.committed); |
| 1885 | var newlines = read.match(/\n/g); |
| 1886 | var line = newlines ? lastLine + newlines.length : lastLine; |
| 1887 | var column = newlines ? read.length - read.lastIndexOf('\n') - 1 : lastColumn + read.length; |
| 1888 | return {line: line, column: column}; |
| 1889 | } |
| 1890 | }; |
| 1891 | |
| 1892 | exports.InputStream = InputStream; |
| 1893 | |
| 1894 | }, |
| 1895 | {}], |
| 1896 | 4:[function(_dereq_,module,exports){ |
| 1897 | var SpecialElements = { |
| 1898 | "http://www.w3.org/1999/xhtml": [ |
| 1899 | 'address', |
| 1900 | 'applet', |
| 1901 | 'area', |
| 1902 | 'article', |
| 1903 | 'aside', |
| 1904 | 'base', |
| 1905 | 'basefont', |
| 1906 | 'bgsound', |
| 1907 | 'blockquote', |
| 1908 | 'body', |
| 1909 | 'br', |
| 1910 | 'button', |
| 1911 | 'caption', |
| 1912 | 'center', |
| 1913 | 'col', |
| 1914 | 'colgroup', |
| 1915 | 'dd', |
| 1916 | 'details', |
| 1917 | 'dir', |
| 1918 | 'div', |
| 1919 | 'dl', |
| 1920 | 'dt', |
| 1921 | 'embed', |
| 1922 | 'fieldset', |
| 1923 | 'figcaption', |
| 1924 | 'figure', |
| 1925 | 'footer', |
| 1926 | 'form', |
| 1927 | 'frame', |
| 1928 | 'frameset', |
| 1929 | 'h1', |
| 1930 | 'h2', |
| 1931 | 'h3', |
| 1932 | 'h4', |
| 1933 | 'h5', |
| 1934 | 'h6', |
| 1935 | 'head', |
| 1936 | 'header', |
| 1937 | 'hgroup', |
| 1938 | 'hr', |
| 1939 | 'html', |
| 1940 | 'iframe', |
| 1941 | 'img', |
| 1942 | 'input', |
| 1943 | 'isindex', |
| 1944 | 'li', |
| 1945 | 'link', |
| 1946 | 'listing', |
| 1947 | 'main', |
| 1948 | 'marquee', |
| 1949 | 'menu', |
| 1950 | 'menuitem', |
| 1951 | 'meta', |
| 1952 | 'nav', |
| 1953 | 'noembed', |
| 1954 | 'noframes', |
| 1955 | 'noscript', |
| 1956 | 'object', |
| 1957 | 'ol', |
| 1958 | 'p', |
| 1959 | 'param', |
| 1960 | 'plaintext', |
| 1961 | 'pre', |
| 1962 | 'script', |
| 1963 | 'section', |
| 1964 | 'select', |
| 1965 | 'source', |
| 1966 | 'style', |
| 1967 | 'summary', |
| 1968 | 'table', |
| 1969 | 'tbody', |
| 1970 | 'td', |
| 1971 | 'textarea', |
| 1972 | 'tfoot', |
| 1973 | 'th', |
| 1974 | 'thead', |
| 1975 | 'title', |
| 1976 | 'tr', |
| 1977 | 'track', |
| 1978 | 'ul', |
| 1979 | 'wbr', |
| 1980 | 'xmp' |
| 1981 | ], |
| 1982 | "http://www.w3.org/1998/Math/MathML": [ |
| 1983 | 'mi', |
| 1984 | 'mo', |
| 1985 | 'mn', |
| 1986 | 'ms', |
| 1987 | 'mtext', |
| 1988 | 'annotation-xml' |
| 1989 | ], |
| 1990 | "http://www.w3.org/2000/svg": [ |
| 1991 | 'foreignObject', |
| 1992 | 'desc', |
| 1993 | 'title' |
| 1994 | ] |
| 1995 | }; |
| 1996 | |
| 1997 | |
| 1998 | function StackItem(namespaceURI, localName, attributes, node) { |
| 1999 | this.localName = localName; |
| 2000 | this.namespaceURI = namespaceURI; |
| 2001 | this.attributes = attributes; |
| 2002 | this.node = node; |
| 2003 | } |
| 2004 | StackItem.prototype.isSpecial = function() { |
| 2005 | return this.namespaceURI in SpecialElements && |
| 2006 | SpecialElements[this.namespaceURI].indexOf(this.localName) > -1; |
| 2007 | }; |
| 2008 | |
| 2009 | StackItem.prototype.isFosterParenting = function() { |
| 2010 | if (this.namespaceURI === "http://www.w3.org/1999/xhtml") { |
| 2011 | return this.localName === 'table' || |
| 2012 | this.localName === 'tbody' || |
| 2013 | this.localName === 'tfoot' || |
| 2014 | this.localName === 'thead' || |
| 2015 | this.localName === 'tr'; |
| 2016 | } |
| 2017 | return false; |
| 2018 | }; |
| 2019 | |
| 2020 | StackItem.prototype.isNumberedHeader = function() { |
| 2021 | if (this.namespaceURI === "http://www.w3.org/1999/xhtml") { |
| 2022 | return this.localName === 'h1' || |
| 2023 | this.localName === 'h2' || |
| 2024 | this.localName === 'h3' || |
| 2025 | this.localName === 'h4' || |
| 2026 | this.localName === 'h5' || |
| 2027 | this.localName === 'h6'; |
| 2028 | } |
| 2029 | return false; |
| 2030 | }; |
| 2031 | |
| 2032 | StackItem.prototype.isForeign = function() { |
| 2033 | return this.namespaceURI != "http://www.w3.org/1999/xhtml"; |
| 2034 | }; |
| 2035 | |
| 2036 | function getAttribute(item, name) { |
| 2037 | for (var i = 0; i < item.attributes.length; i++) { |
| 2038 | if (item.attributes[i].nodeName == name) |
| 2039 | return item.attributes[i].nodeValue; |
| 2040 | } |
| 2041 | return null; |
| 2042 | } |
| 2043 | |
| 2044 | StackItem.prototype.isHtmlIntegrationPoint = function() { |
| 2045 | if (this.namespaceURI === "http://www.w3.org/1998/Math/MathML") { |
| 2046 | if (this.localName !== "annotation-xml") |
| 2047 | return false; |
| 2048 | var encoding = getAttribute(this, 'encoding'); |
| 2049 | if (!encoding) |
| 2050 | return false; |
| 2051 | encoding = encoding.toLowerCase(); |
| 2052 | return encoding === "text/html" || encoding === "application/xhtml+xml"; |
| 2053 | } |
| 2054 | if (this.namespaceURI === "http://www.w3.org/2000/svg") { |
| 2055 | return this.localName === "foreignObject" |
| 2056 | || this.localName === "desc" |
| 2057 | || this.localName === "title"; |
| 2058 | } |
| 2059 | return false; |
| 2060 | }; |
| 2061 | |
| 2062 | StackItem.prototype.isMathMLTextIntegrationPoint = function() { |
| 2063 | if (this.namespaceURI === "http://www.w3.org/1998/Math/MathML") { |
| 2064 | return this.localName === "mi" |
| 2065 | || this.localName === "mo" |
| 2066 | || this.localName === "mn" |
| 2067 | || this.localName === "ms" |
| 2068 | || this.localName === "mtext"; |
| 2069 | } |
| 2070 | return false; |
| 2071 | }; |
| 2072 | |
| 2073 | exports.StackItem = StackItem; |
| 2074 | |
| 2075 | }, |
| 2076 | {}], |
| 2077 | 5:[function(_dereq_,module,exports){ |
| 2078 | var InputStream = _dereq_('./InputStream').InputStream; |
| 2079 | var EntityParser = _dereq_('./EntityParser').EntityParser; |
| 2080 | |
| 2081 | function isWhitespace(c){ |
| 2082 | return c === " " || c === "\n" || c === "\t" || c === "\r" || c === "\f"; |
| 2083 | } |
| 2084 | |
| 2085 | function isAlpha(c) { |
| 2086 | return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); |
| 2087 | } |
| 2088 | function Tokenizer(tokenHandler) { |
| 2089 | this._tokenHandler = tokenHandler; |
| 2090 | this._state = Tokenizer.DATA; |
| 2091 | this._inputStream = new InputStream(); |
| 2092 | this._currentToken = null; |
| 2093 | this._temporaryBuffer = ''; |
| 2094 | this._additionalAllowedCharacter = ''; |
| 2095 | } |
| 2096 | |
| 2097 | Tokenizer.prototype._parseError = function(code, args) { |
| 2098 | this._tokenHandler.parseError(code, args); |
| 2099 | }; |
| 2100 | |
| 2101 | Tokenizer.prototype._emitToken = function(token) { |
| 2102 | if (token.type === 'StartTag') { |
| 2103 | for (var i = 1; i < token.data.length; i++) { |
| 2104 | if (!token.data[i].nodeName) |
| 2105 | token.data.splice(i--, 1); |
| 2106 | } |
| 2107 | } else if (token.type === 'EndTag') { |
| 2108 | if (token.selfClosing) { |
| 2109 | this._parseError('self-closing-flag-on-end-tag'); |
| 2110 | } |
| 2111 | if (token.data.length !== 0) { |
| 2112 | this._parseError('attributes-in-end-tag'); |
| 2113 | } |
| 2114 | } |
| 2115 | this._tokenHandler.processToken(token); |
| 2116 | if (token.type === 'StartTag' && token.selfClosing && !this._tokenHandler.isSelfClosingFlagAcknowledged()) { |
| 2117 | this._parseError('non-void-element-with-trailing-solidus', {name: token.name}); |
| 2118 | } |
| 2119 | }; |
| 2120 | |
| 2121 | Tokenizer.prototype._emitCurrentToken = function() { |
| 2122 | this._state = Tokenizer.DATA; |
| 2123 | this._emitToken(this._currentToken); |
| 2124 | }; |
| 2125 | |
| 2126 | Tokenizer.prototype._currentAttribute = function() { |
| 2127 | return this._currentToken.data[this._currentToken.data.length - 1]; |
| 2128 | }; |
| 2129 | |
| 2130 | Tokenizer.prototype.setState = function(state) { |
| 2131 | this._state = state; |
| 2132 | }; |
| 2133 | |
| 2134 | Tokenizer.prototype.tokenize = function(source) { |
| 2135 | Tokenizer.DATA = data_state; |
| 2136 | Tokenizer.RCDATA = rcdata_state; |
| 2137 | Tokenizer.RAWTEXT = rawtext_state; |
| 2138 | Tokenizer.SCRIPT_DATA = script_data_state; |
| 2139 | Tokenizer.PLAINTEXT = plaintext_state; |
| 2140 | |
| 2141 | |
| 2142 | this._state = Tokenizer.DATA; |
| 2143 | |
| 2144 | this._inputStream.append(source); |
| 2145 | |
| 2146 | this._tokenHandler.startTokenization(this); |
| 2147 | |
| 2148 | this._inputStream.eof = true; |
| 2149 | |
| 2150 | var tokenizer = this; |
| 2151 | |
| 2152 | while (this._state.call(this, this._inputStream)); |
| 2153 | |
| 2154 | |
| 2155 | function data_state(buffer) { |
| 2156 | var data = buffer.char(); |
| 2157 | if (data === InputStream.EOF) { |
| 2158 | tokenizer._emitToken({type: 'EOF', data: null}); |
| 2159 | return false; |
| 2160 | } else if (data === '&') { |
| 2161 | tokenizer.setState(character_reference_in_data_state); |
| 2162 | } else if (data === '<') { |
| 2163 | tokenizer.setState(tag_open_state); |
| 2164 | } else if (data === '\u0000') { |
| 2165 | tokenizer._emitToken({type: 'Characters', data: data}); |
| 2166 | buffer.commit(); |
| 2167 | } else { |
| 2168 | var chars = buffer.matchUntil("&|<|\u0000"); |
| 2169 | tokenizer._emitToken({type: 'Characters', data: data + chars}); |
| 2170 | buffer.commit(); |
| 2171 | } |
| 2172 | return true; |
| 2173 | } |
| 2174 | |
| 2175 | function character_reference_in_data_state(buffer) { |
| 2176 | var character = EntityParser.consumeEntity(buffer, tokenizer); |
| 2177 | tokenizer.setState(data_state); |
| 2178 | tokenizer._emitToken({type: 'Characters', data: character || '&'}); |
| 2179 | return true; |
| 2180 | } |
| 2181 | |
| 2182 | function rcdata_state(buffer) { |
| 2183 | var data = buffer.char(); |
| 2184 | if (data === InputStream.EOF) { |
| 2185 | tokenizer._emitToken({type: 'EOF', data: null}); |
| 2186 | return false; |
| 2187 | } else if (data === '&') { |
| 2188 | tokenizer.setState(character_reference_in_rcdata_state); |
| 2189 | } else if (data === '<') { |
| 2190 | tokenizer.setState(rcdata_less_than_sign_state); |
| 2191 | } else if (data === "\u0000") { |
| 2192 | tokenizer._parseError("invalid-codepoint"); |
| 2193 | tokenizer._emitToken({type: 'Characters', data: '\uFFFD'}); |
| 2194 | buffer.commit(); |
| 2195 | } else { |
| 2196 | var chars = buffer.matchUntil("&|<|\u0000"); |
| 2197 | tokenizer._emitToken({type: 'Characters', data: data + chars}); |
| 2198 | buffer.commit(); |
| 2199 | } |
| 2200 | return true; |
| 2201 | } |
| 2202 | |
| 2203 | function character_reference_in_rcdata_state(buffer) { |
| 2204 | var character = EntityParser.consumeEntity(buffer, tokenizer); |
| 2205 | tokenizer.setState(rcdata_state); |
| 2206 | tokenizer._emitToken({type: 'Characters', data: character || '&'}); |
| 2207 | return true; |
| 2208 | } |
| 2209 | |
| 2210 | function rawtext_state(buffer) { |
| 2211 | var data = buffer.char(); |
| 2212 | if (data === InputStream.EOF) { |
| 2213 | tokenizer._emitToken({type: 'EOF', data: null}); |
| 2214 | return false; |
| 2215 | } else if (data === '<') { |
| 2216 | tokenizer.setState(rawtext_less_than_sign_state); |
| 2217 | } else if (data === "\u0000") { |
| 2218 | tokenizer._parseError("invalid-codepoint"); |
| 2219 | tokenizer._emitToken({type: 'Characters', data: '\uFFFD'}); |
| 2220 | buffer.commit(); |
| 2221 | } else { |
| 2222 | var chars = buffer.matchUntil("<|\u0000"); |
| 2223 | tokenizer._emitToken({type: 'Characters', data: data + chars}); |
| 2224 | } |
| 2225 | return true; |
| 2226 | } |
| 2227 | |
| 2228 | function plaintext_state(buffer) { |
| 2229 | var data = buffer.char(); |
| 2230 | if (data === InputStream.EOF) { |
| 2231 | tokenizer._emitToken({type: 'EOF', data: null}); |
| 2232 | return false; |
| 2233 | } else if (data === "\u0000") { |
| 2234 | tokenizer._parseError("invalid-codepoint"); |
| 2235 | tokenizer._emitToken({type: 'Characters', data: '\uFFFD'}); |
| 2236 | buffer.commit(); |
| 2237 | } else { |
| 2238 | var chars = buffer.matchUntil("\u0000"); |
| 2239 | tokenizer._emitToken({type: 'Characters', data: data + chars}); |
| 2240 | } |
| 2241 | return true; |
| 2242 | } |
| 2243 | |
| 2244 | |
| 2245 | function script_data_state(buffer) { |
| 2246 | var data = buffer.char(); |
| 2247 | if (data === InputStream.EOF) { |
| 2248 | tokenizer._emitToken({type: 'EOF', data: null}); |
| 2249 | return false; |
| 2250 | } else if (data === '<') { |
| 2251 | tokenizer.setState(script_data_less_than_sign_state); |
| 2252 | } else if (data === '\u0000') { |
| 2253 | tokenizer._parseError("invalid-codepoint"); |
| 2254 | tokenizer._emitToken({type: 'Characters', data: '\uFFFD'}); |
| 2255 | buffer.commit(); |
| 2256 | } else { |
| 2257 | var chars = buffer.matchUntil("<|\u0000"); |
| 2258 | tokenizer._emitToken({type: 'Characters', data: data + chars}); |
| 2259 | } |
| 2260 | return true; |
| 2261 | } |
| 2262 | |
| 2263 | function rcdata_less_than_sign_state(buffer) { |
| 2264 | var data = buffer.char(); |
| 2265 | if (data === "/") { |
| 2266 | this._temporaryBuffer = ''; |
| 2267 | tokenizer.setState(rcdata_end_tag_open_state); |
| 2268 | } else { |
| 2269 | tokenizer._emitToken({type: 'Characters', data: '<'}); |
| 2270 | buffer.unget(data); |
| 2271 | tokenizer.setState(rcdata_state); |
| 2272 | } |
| 2273 | return true; |
| 2274 | } |
| 2275 | |
| 2276 | function rcdata_end_tag_open_state(buffer) { |
| 2277 | var data = buffer.char(); |
| 2278 | if (isAlpha(data)) { |
| 2279 | this._temporaryBuffer += data; |
| 2280 | tokenizer.setState(rcdata_end_tag_name_state); |
| 2281 | } else { |
| 2282 | tokenizer._emitToken({type: 'Characters', data: '</'}); |
| 2283 | buffer.unget(data); |
| 2284 | tokenizer.setState(rcdata_state); |
| 2285 | } |
| 2286 | return true; |
| 2287 | } |
| 2288 | |
| 2289 | function rcdata_end_tag_name_state(buffer) { |
| 2290 | var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase()); |
| 2291 | var data = buffer.char(); |
| 2292 | if (isWhitespace(data) && appropriate) { |
| 2293 | tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false}; |
| 2294 | tokenizer.setState(before_attribute_name_state); |
| 2295 | } else if (data === '/' && appropriate) { |
| 2296 | tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false}; |
| 2297 | tokenizer.setState(self_closing_tag_state); |
| 2298 | } else if (data === '>' && appropriate) { |
| 2299 | tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false}; |
| 2300 | tokenizer._emitCurrentToken(); |
| 2301 | tokenizer.setState(data_state); |
| 2302 | } else if (isAlpha(data)) { |
| 2303 | this._temporaryBuffer += data; |
| 2304 | buffer.commit(); |
| 2305 | } else { |
| 2306 | tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer}); |
| 2307 | buffer.unget(data); |
| 2308 | tokenizer.setState(rcdata_state); |
| 2309 | } |
| 2310 | return true; |
| 2311 | } |
| 2312 | |
| 2313 | function rawtext_less_than_sign_state(buffer) { |
| 2314 | var data = buffer.char(); |
| 2315 | if (data === "/") { |
| 2316 | this._temporaryBuffer = ''; |
| 2317 | tokenizer.setState(rawtext_end_tag_open_state); |
| 2318 | } else { |
| 2319 | tokenizer._emitToken({type: 'Characters', data: '<'}); |
| 2320 | buffer.unget(data); |
| 2321 | tokenizer.setState(rawtext_state); |
| 2322 | } |
| 2323 | return true; |
| 2324 | } |
| 2325 | |
| 2326 | function rawtext_end_tag_open_state(buffer) { |
| 2327 | var data = buffer.char(); |
| 2328 | if (isAlpha(data)) { |
| 2329 | this._temporaryBuffer += data; |
| 2330 | tokenizer.setState(rawtext_end_tag_name_state); |
| 2331 | } else { |
| 2332 | tokenizer._emitToken({type: 'Characters', data: '</'}); |
| 2333 | buffer.unget(data); |
| 2334 | tokenizer.setState(rawtext_state); |
| 2335 | } |
| 2336 | return true; |
| 2337 | } |
| 2338 | |
| 2339 | function rawtext_end_tag_name_state(buffer) { |
| 2340 | var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase()); |
| 2341 | var data = buffer.char(); |
| 2342 | if (isWhitespace(data) && appropriate) { |
| 2343 | tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false}; |
| 2344 | tokenizer.setState(before_attribute_name_state); |
| 2345 | } else if (data === '/' && appropriate) { |
| 2346 | tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false}; |
| 2347 | tokenizer.setState(self_closing_tag_state); |
| 2348 | } else if (data === '>' && appropriate) { |
| 2349 | tokenizer._currentToken = {type: 'EndTag', name: this._temporaryBuffer, data: [], selfClosing: false}; |
| 2350 | tokenizer._emitCurrentToken(); |
| 2351 | tokenizer.setState(data_state); |
| 2352 | } else if (isAlpha(data)) { |
| 2353 | this._temporaryBuffer += data; |
| 2354 | buffer.commit(); |
| 2355 | } else { |
| 2356 | tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer}); |
| 2357 | buffer.unget(data); |
| 2358 | tokenizer.setState(rawtext_state); |
| 2359 | } |
| 2360 | return true; |
| 2361 | } |
| 2362 | |
| 2363 | function script_data_less_than_sign_state(buffer) { |
| 2364 | var data = buffer.char(); |
| 2365 | if (data === "/") { |
| 2366 | this._temporaryBuffer = ''; |
| 2367 | tokenizer.setState(script_data_end_tag_open_state); |
| 2368 | } else if (data === '!') { |
| 2369 | tokenizer._emitToken({type: 'Characters', data: '<!'}); |
| 2370 | tokenizer.setState(script_data_escape_start_state); |
| 2371 | } else { |
| 2372 | tokenizer._emitToken({type: 'Characters', data: '<'}); |
| 2373 | buffer.unget(data); |
| 2374 | tokenizer.setState(script_data_state); |
| 2375 | } |
| 2376 | return true; |
| 2377 | } |
| 2378 | |
| 2379 | function script_data_end_tag_open_state(buffer) { |
| 2380 | var data = buffer.char(); |
| 2381 | if (isAlpha(data)) { |
| 2382 | this._temporaryBuffer += data; |
| 2383 | tokenizer.setState(script_data_end_tag_name_state); |
| 2384 | } else { |
| 2385 | tokenizer._emitToken({type: 'Characters', data: '</'}); |
| 2386 | buffer.unget(data); |
| 2387 | tokenizer.setState(script_data_state); |
| 2388 | } |
| 2389 | return true; |
| 2390 | } |
| 2391 | |
| 2392 | function script_data_end_tag_name_state(buffer) { |
| 2393 | var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase()); |
| 2394 | var data = buffer.char(); |
| 2395 | if (isWhitespace(data) && appropriate) { |
| 2396 | tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false}; |
| 2397 | tokenizer.setState(before_attribute_name_state); |
| 2398 | } else if (data === '/' && appropriate) { |
| 2399 | tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false}; |
| 2400 | tokenizer.setState(self_closing_tag_state); |
| 2401 | } else if (data === '>' && appropriate) { |
| 2402 | tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false}; |
| 2403 | tokenizer._emitCurrentToken(); |
| 2404 | } else if (isAlpha(data)) { |
| 2405 | this._temporaryBuffer += data; |
| 2406 | buffer.commit(); |
| 2407 | } else { |
| 2408 | tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer}); |
| 2409 | buffer.unget(data); |
| 2410 | tokenizer.setState(script_data_state); |
| 2411 | } |
| 2412 | return true; |
| 2413 | } |
| 2414 | |
| 2415 | function script_data_escape_start_state(buffer) { |
| 2416 | var data = buffer.char(); |
| 2417 | if (data === '-') { |
| 2418 | tokenizer._emitToken({type: 'Characters', data: '-'}); |
| 2419 | tokenizer.setState(script_data_escape_start_dash_state); |
| 2420 | } else { |
| 2421 | buffer.unget(data); |
| 2422 | tokenizer.setState(script_data_state); |
| 2423 | } |
| 2424 | return true; |
| 2425 | } |
| 2426 | |
| 2427 | function script_data_escape_start_dash_state(buffer) { |
| 2428 | var data = buffer.char(); |
| 2429 | if (data === '-') { |
| 2430 | tokenizer._emitToken({type: 'Characters', data: '-'}); |
| 2431 | tokenizer.setState(script_data_escaped_dash_dash_state); |
| 2432 | } else { |
| 2433 | buffer.unget(data); |
| 2434 | tokenizer.setState(script_data_state); |
| 2435 | } |
| 2436 | return true; |
| 2437 | } |
| 2438 | |
| 2439 | function script_data_escaped_state(buffer) { |
| 2440 | var data = buffer.char(); |
| 2441 | if (data === InputStream.EOF) { |
| 2442 | buffer.unget(data); |
| 2443 | tokenizer.setState(data_state); |
| 2444 | } else if (data === '-') { |
| 2445 | tokenizer._emitToken({type: 'Characters', data: '-'}); |
| 2446 | tokenizer.setState(script_data_escaped_dash_state); |
| 2447 | } else if (data === '<') { |
| 2448 | tokenizer.setState(script_data_escaped_less_then_sign_state); |
| 2449 | } else if (data === '\u0000') { |
| 2450 | tokenizer._parseError("invalid-codepoint"); |
| 2451 | tokenizer._emitToken({type: 'Characters', data: '\uFFFD'}); |
| 2452 | buffer.commit(); |
| 2453 | } else { |
| 2454 | var chars = buffer.matchUntil('<|-|\u0000'); |
| 2455 | tokenizer._emitToken({type: 'Characters', data: data + chars}); |
| 2456 | } |
| 2457 | return true; |
| 2458 | } |
| 2459 | |
| 2460 | function script_data_escaped_dash_state(buffer) { |
| 2461 | var data = buffer.char(); |
| 2462 | if (data === InputStream.EOF) { |
| 2463 | buffer.unget(data); |
| 2464 | tokenizer.setState(data_state); |
| 2465 | } else if (data === '-') { |
| 2466 | tokenizer._emitToken({type: 'Characters', data: '-'}); |
| 2467 | tokenizer.setState(script_data_escaped_dash_dash_state); |
| 2468 | } else if (data === '<') { |
| 2469 | tokenizer.setState(script_data_escaped_less_then_sign_state); |
| 2470 | } else if (data === '\u0000') { |
| 2471 | tokenizer._parseError("invalid-codepoint"); |
| 2472 | tokenizer._emitToken({type: 'Characters', data: '\uFFFD'}); |
| 2473 | tokenizer.setState(script_data_escaped_state); |
| 2474 | } else { |
| 2475 | tokenizer._emitToken({type: 'Characters', data: data}); |
| 2476 | tokenizer.setState(script_data_escaped_state); |
| 2477 | } |
| 2478 | return true; |
| 2479 | } |
| 2480 | |
| 2481 | function script_data_escaped_dash_dash_state(buffer) { |
| 2482 | var data = buffer.char(); |
| 2483 | if (data === InputStream.EOF) { |
| 2484 | tokenizer._parseError('eof-in-script'); |
| 2485 | buffer.unget(data); |
| 2486 | tokenizer.setState(data_state); |
| 2487 | } else if (data === '<') { |
| 2488 | tokenizer.setState(script_data_escaped_less_then_sign_state); |
| 2489 | } else if (data === '>') { |
| 2490 | tokenizer._emitToken({type: 'Characters', data: '>'}); |
| 2491 | tokenizer.setState(script_data_state); |
| 2492 | } else if (data === '\u0000') { |
| 2493 | tokenizer._parseError("invalid-codepoint"); |
| 2494 | tokenizer._emitToken({type: 'Characters', data: '\uFFFD'}); |
| 2495 | tokenizer.setState(script_data_escaped_state); |
| 2496 | } else { |
| 2497 | tokenizer._emitToken({type: 'Characters', data: data}); |
| 2498 | tokenizer.setState(script_data_escaped_state); |
| 2499 | } |
| 2500 | return true; |
| 2501 | } |
| 2502 | |
| 2503 | function script_data_escaped_less_then_sign_state(buffer) { |
| 2504 | var data = buffer.char(); |
| 2505 | if (data === '/') { |
| 2506 | this._temporaryBuffer = ''; |
| 2507 | tokenizer.setState(script_data_escaped_end_tag_open_state); |
| 2508 | } else if (isAlpha(data)) { |
| 2509 | tokenizer._emitToken({type: 'Characters', data: '<' + data}); |
| 2510 | this._temporaryBuffer = data; |
| 2511 | tokenizer.setState(script_data_double_escape_start_state); |
| 2512 | } else { |
| 2513 | tokenizer._emitToken({type: 'Characters', data: '<'}); |
| 2514 | buffer.unget(data); |
| 2515 | tokenizer.setState(script_data_escaped_state); |
| 2516 | } |
| 2517 | return true; |
| 2518 | } |
| 2519 | |
| 2520 | function script_data_escaped_end_tag_open_state(buffer) { |
| 2521 | var data = buffer.char(); |
| 2522 | if (isAlpha(data)) { |
| 2523 | this._temporaryBuffer = data; |
| 2524 | tokenizer.setState(script_data_escaped_end_tag_name_state); |
| 2525 | } else { |
| 2526 | tokenizer._emitToken({type: 'Characters', data: '</'}); |
| 2527 | buffer.unget(data); |
| 2528 | tokenizer.setState(script_data_escaped_state); |
| 2529 | } |
| 2530 | return true; |
| 2531 | } |
| 2532 | |
| 2533 | function script_data_escaped_end_tag_name_state(buffer) { |
| 2534 | var appropriate = tokenizer._currentToken && (tokenizer._currentToken.name === this._temporaryBuffer.toLowerCase()); |
| 2535 | var data = buffer.char(); |
| 2536 | if (isWhitespace(data) && appropriate) { |
| 2537 | tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false}; |
| 2538 | tokenizer.setState(before_attribute_name_state); |
| 2539 | } else if (data === '/' && appropriate) { |
| 2540 | tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false}; |
| 2541 | tokenizer.setState(self_closing_tag_state); |
| 2542 | } else if (data === '>' && appropriate) { |
| 2543 | tokenizer._currentToken = {type: 'EndTag', name: 'script', data: [], selfClosing: false}; |
| 2544 | tokenizer.setState(data_state); |
| 2545 | tokenizer._emitCurrentToken(); |
| 2546 | } else if (isAlpha(data)) { |
| 2547 | this._temporaryBuffer += data; |
| 2548 | buffer.commit(); |
| 2549 | } else { |
| 2550 | tokenizer._emitToken({type: 'Characters', data: '</' + this._temporaryBuffer}); |
| 2551 | buffer.unget(data); |
| 2552 | tokenizer.setState(script_data_escaped_state); |
| 2553 | } |
| 2554 | return true; |
| 2555 | } |
| 2556 | |
| 2557 | function script_data_double_escape_start_state(buffer) { |
| 2558 | var data = buffer.char(); |
| 2559 | if (isWhitespace(data) || data === '/' || data === '>') { |
| 2560 | tokenizer._emitToken({type: 'Characters', data: data}); |
| 2561 | if (this._temporaryBuffer.toLowerCase() === 'script') |
| 2562 | tokenizer.setState(script_data_double_escaped_state); |
| 2563 | else |
| 2564 | tokenizer.setState(script_data_escaped_state); |
| 2565 | } else if (isAlpha(data)) { |
| 2566 | tokenizer._emitToken({type: 'Characters', data: data}); |
| 2567 | this._temporaryBuffer += data; |
| 2568 | buffer.commit(); |
| 2569 | } else { |
| 2570 | buffer.unget(data); |
| 2571 | tokenizer.setState(script_data_escaped_state); |
| 2572 | } |
| 2573 | return true; |
| 2574 | } |
| 2575 | |
| 2576 | function script_data_double_escaped_state(buffer) { |
| 2577 | var data = buffer.char(); |
| 2578 | if (data === InputStream.EOF) { |
| 2579 | tokenizer._parseError('eof-in-script'); |
| 2580 | buffer.unget(data); |
| 2581 | tokenizer.setState(data_state); |
| 2582 | } else if (data === '-') { |
| 2583 | tokenizer._emitToken({type: 'Characters', data: '-'}); |
| 2584 | tokenizer.setState(script_data_double_escaped_dash_state); |
| 2585 | } else if (data === '<') { |
| 2586 | tokenizer._emitToken({type: 'Characters', data: '<'}); |
| 2587 | tokenizer.setState(script_data_double_escaped_less_than_sign_state); |
| 2588 | } else if (data === '\u0000') { |
| 2589 | tokenizer._parseError('invalid-codepoint'); |
| 2590 | tokenizer._emitToken({type: 'Characters', data: '\uFFFD'}); |
| 2591 | buffer.commit(); |
| 2592 | } else { |
| 2593 | tokenizer._emitToken({type: 'Characters', data: data}); |
| 2594 | buffer.commit(); |
| 2595 | } |
| 2596 | return true; |
| 2597 | } |
| 2598 | |
| 2599 | function script_data_double_escaped_dash_state(buffer) { |
| 2600 | var data = buffer.char(); |
| 2601 | if (data === InputStream.EOF) { |
| 2602 | tokenizer._parseError('eof-in-script'); |
| 2603 | buffer.unget(data); |
| 2604 | tokenizer.setState(data_state); |
| 2605 | } else if (data === '-') { |
| 2606 | tokenizer._emitToken({type: 'Characters', data: '-'}); |
| 2607 | tokenizer.setState(script_data_double_escaped_dash_dash_state); |
| 2608 | } else if (data === '<') { |
| 2609 | tokenizer._emitToken({type: 'Characters', data: '<'}); |
| 2610 | tokenizer.setState(script_data_double_escaped_less_than_sign_state); |
| 2611 | } else if (data === '\u0000') { |
| 2612 | tokenizer._parseError('invalid-codepoint'); |
| 2613 | tokenizer._emitToken({type: 'Characters', data: '\uFFFD'}); |
| 2614 | tokenizer.setState(script_data_double_escaped_state); |
| 2615 | } else { |
| 2616 | tokenizer._emitToken({type: 'Characters', data: data}); |
| 2617 | tokenizer.setState(script_data_double_escaped_state); |
| 2618 | } |
| 2619 | return true; |
| 2620 | } |
| 2621 | |
| 2622 | function script_data_double_escaped_dash_dash_state(buffer) { |
| 2623 | var data = buffer.char(); |
| 2624 | if (data === InputStream.EOF) { |
| 2625 | tokenizer._parseError('eof-in-script'); |
| 2626 | buffer.unget(data); |
| 2627 | tokenizer.setState(data_state); |
| 2628 | } else if (data === '-') { |
| 2629 | tokenizer._emitToken({type: 'Characters', data: '-'}); |
| 2630 | buffer.commit(); |
| 2631 | } else if (data === '<') { |
| 2632 | tokenizer._emitToken({type: 'Characters', data: '<'}); |
| 2633 | tokenizer.setState(script_data_double_escaped_less_than_sign_state); |
| 2634 | } else if (data === '>') { |
| 2635 | tokenizer._emitToken({type: 'Characters', data: '>'}); |
| 2636 | tokenizer.setState(script_data_state); |
| 2637 | } else if (data === '\u0000') { |
| 2638 | tokenizer._parseError('invalid-codepoint'); |
| 2639 | tokenizer._emitToken({type: 'Characters', data: '\uFFFD'}); |
| 2640 | tokenizer.setState(script_data_double_escaped_state); |
| 2641 | } else { |
| 2642 | tokenizer._emitToken({type: 'Characters', data: data}); |
| 2643 | tokenizer.setState(script_data_double_escaped_state); |
| 2644 | } |
| 2645 | return true; |
| 2646 | } |
| 2647 | |
| 2648 | function script_data_double_escaped_less_than_sign_state(buffer) { |
| 2649 | var data = buffer.char(); |
| 2650 | if (data === '/') { |
| 2651 | tokenizer._emitToken({type: 'Characters', data: '/'}); |
| 2652 | this._temporaryBuffer = ''; |
| 2653 | tokenizer.setState(script_data_double_escape_end_state); |
| 2654 | } else { |
| 2655 | buffer.unget(data); |
| 2656 | tokenizer.setState(script_data_double_escaped_state); |
| 2657 | } |
| 2658 | return true; |
| 2659 | } |
| 2660 | |
| 2661 | function script_data_double_escape_end_state(buffer) { |
| 2662 | var data = buffer.char(); |
| 2663 | if (isWhitespace(data) || data === '/' || data === '>') { |
| 2664 | tokenizer._emitToken({type: 'Characters', data: data}); |
| 2665 | if (this._temporaryBuffer.toLowerCase() === 'script') |
| 2666 | tokenizer.setState(script_data_escaped_state); |
| 2667 | else |
| 2668 | tokenizer.setState(script_data_double_escaped_state); |
| 2669 | } else if (isAlpha(data)) { |
| 2670 | tokenizer._emitToken({type: 'Characters', data: data}); |
| 2671 | this._temporaryBuffer += data; |
| 2672 | buffer.commit(); |
| 2673 | } else { |
| 2674 | buffer.unget(data); |
| 2675 | tokenizer.setState(script_data_double_escaped_state); |
| 2676 | } |
| 2677 | return true; |
| 2678 | } |
| 2679 | |
| 2680 | function tag_open_state(buffer) { |
| 2681 | var data = buffer.char(); |
| 2682 | if (data === InputStream.EOF) { |
| 2683 | tokenizer._parseError("bare-less-than-sign-at-eof"); |
| 2684 | tokenizer._emitToken({type: 'Characters', data: '<'}); |
| 2685 | buffer.unget(data); |
| 2686 | tokenizer.setState(data_state); |
| 2687 | } else if (isAlpha(data)) { |
| 2688 | tokenizer._currentToken = {type: 'StartTag', name: data.toLowerCase(), data: []}; |
| 2689 | tokenizer.setState(tag_name_state); |
| 2690 | } else if (data === '!') { |
| 2691 | tokenizer.setState(markup_declaration_open_state); |
| 2692 | } else if (data === '/') { |
| 2693 | tokenizer.setState(close_tag_open_state); |
| 2694 | } else if (data === '>') { |
| 2695 | tokenizer._parseError("expected-tag-name-but-got-right-bracket"); |
| 2696 | tokenizer._emitToken({type: 'Characters', data: "<>"}); |
| 2697 | tokenizer.setState(data_state); |
| 2698 | } else if (data === '?') { |
| 2699 | tokenizer._parseError("expected-tag-name-but-got-question-mark"); |
| 2700 | buffer.unget(data); |
| 2701 | tokenizer.setState(bogus_comment_state); |
| 2702 | } else { |
| 2703 | tokenizer._parseError("expected-tag-name"); |
| 2704 | tokenizer._emitToken({type: 'Characters', data: "<"}); |
| 2705 | buffer.unget(data); |
| 2706 | tokenizer.setState(data_state); |
| 2707 | } |
| 2708 | return true; |
| 2709 | } |
| 2710 | |
| 2711 | function close_tag_open_state(buffer) { |
| 2712 | var data = buffer.char(); |
| 2713 | if (data === InputStream.EOF) { |
| 2714 | tokenizer._parseError("expected-closing-tag-but-got-eof"); |
| 2715 | tokenizer._emitToken({type: 'Characters', data: '</'}); |
| 2716 | buffer.unget(data); |
| 2717 | tokenizer.setState(data_state); |
| 2718 | } else if (isAlpha(data)) { |
| 2719 | tokenizer._currentToken = {type: 'EndTag', name: data.toLowerCase(), data: []}; |
| 2720 | tokenizer.setState(tag_name_state); |
| 2721 | } else if (data === '>') { |
| 2722 | tokenizer._parseError("expected-closing-tag-but-got-right-bracket"); |
| 2723 | tokenizer.setState(data_state); |
| 2724 | } else { |
| 2725 | tokenizer._parseError("expected-closing-tag-but-got-char", {data: data}); // param 1 is datavars: |
| 2726 | buffer.unget(data); |
| 2727 | tokenizer.setState(bogus_comment_state); |
| 2728 | } |
| 2729 | return true; |
| 2730 | } |
| 2731 | |
| 2732 | function tag_name_state(buffer) { |
| 2733 | var data = buffer.char(); |
| 2734 | if (data === InputStream.EOF) { |
| 2735 | tokenizer._parseError('eof-in-tag-name'); |
| 2736 | buffer.unget(data); |
| 2737 | tokenizer.setState(data_state); |
| 2738 | } else if (isWhitespace(data)) { |
| 2739 | tokenizer.setState(before_attribute_name_state); |
| 2740 | } else if (isAlpha(data)) { |
| 2741 | tokenizer._currentToken.name += data.toLowerCase(); |
| 2742 | } else if (data === '>') { |
| 2743 | tokenizer._emitCurrentToken(); |
| 2744 | } else if (data === '/') { |
| 2745 | tokenizer.setState(self_closing_tag_state); |
| 2746 | } else if (data === '\u0000') { |
| 2747 | tokenizer._parseError("invalid-codepoint"); |
| 2748 | tokenizer._currentToken.name += "\uFFFD"; |
| 2749 | } else { |
| 2750 | tokenizer._currentToken.name += data; |
| 2751 | } |
| 2752 | buffer.commit(); |
| 2753 | |
| 2754 | return true; |
| 2755 | } |
| 2756 | |
| 2757 | function before_attribute_name_state(buffer) { |
| 2758 | var data = buffer.char(); |
| 2759 | if (data === InputStream.EOF) { |
| 2760 | tokenizer._parseError("expected-attribute-name-but-got-eof"); |
| 2761 | buffer.unget(data); |
| 2762 | tokenizer.setState(data_state); |
| 2763 | } else if (isWhitespace(data)) { |
| 2764 | return true; |
| 2765 | } else if (isAlpha(data)) { |
| 2766 | tokenizer._currentToken.data.push({nodeName: data.toLowerCase(), nodeValue: ""}); |
| 2767 | tokenizer.setState(attribute_name_state); |
| 2768 | } else if (data === '>') { |
| 2769 | tokenizer._emitCurrentToken(); |
| 2770 | } else if (data === '/') { |
| 2771 | tokenizer.setState(self_closing_tag_state); |
| 2772 | } else if (data === "'" || data === '"' || data === '=' || data === '<') { |
| 2773 | tokenizer._parseError("invalid-character-in-attribute-name"); |
| 2774 | tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""}); |
| 2775 | tokenizer.setState(attribute_name_state); |
| 2776 | } else if (data === '\u0000') { |
| 2777 | tokenizer._parseError("invalid-codepoint"); |
| 2778 | tokenizer._currentToken.data.push({nodeName: "\uFFFD", nodeValue: ""}); |
| 2779 | } else { |
| 2780 | tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""}); |
| 2781 | tokenizer.setState(attribute_name_state); |
| 2782 | } |
| 2783 | return true; |
| 2784 | } |
| 2785 | |
| 2786 | function attribute_name_state(buffer) { |
| 2787 | var data = buffer.char(); |
| 2788 | var leavingThisState = true; |
| 2789 | var shouldEmit = false; |
| 2790 | if (data === InputStream.EOF) { |
| 2791 | tokenizer._parseError("eof-in-attribute-name"); |
| 2792 | buffer.unget(data); |
| 2793 | tokenizer.setState(data_state); |
| 2794 | shouldEmit = true; |
| 2795 | } else if (data === '=') { |
| 2796 | tokenizer.setState(before_attribute_value_state); |
| 2797 | } else if (isAlpha(data)) { |
| 2798 | tokenizer._currentAttribute().nodeName += data.toLowerCase(); |
| 2799 | leavingThisState = false; |
| 2800 | } else if (data === '>') { |
| 2801 | shouldEmit = true; |
| 2802 | } else if (isWhitespace(data)) { |
| 2803 | tokenizer.setState(after_attribute_name_state); |
| 2804 | } else if (data === '/') { |
| 2805 | tokenizer.setState(self_closing_tag_state); |
| 2806 | } else if (data === "'" || data === '"') { |
| 2807 | tokenizer._parseError("invalid-character-in-attribute-name"); |
| 2808 | tokenizer._currentAttribute().nodeName += data; |
| 2809 | leavingThisState = false; |
| 2810 | } else if (data === '\u0000') { |
| 2811 | tokenizer._parseError("invalid-codepoint"); |
| 2812 | tokenizer._currentAttribute().nodeName += "\uFFFD"; |
| 2813 | } else { |
| 2814 | tokenizer._currentAttribute().nodeName += data; |
| 2815 | leavingThisState = false; |
| 2816 | } |
| 2817 | |
| 2818 | if (leavingThisState) { |
| 2819 | var attributes = tokenizer._currentToken.data; |
| 2820 | var currentAttribute = attributes[attributes.length - 1]; |
| 2821 | for (var i = attributes.length - 2; i >= 0; i--) { |
| 2822 | if (currentAttribute.nodeName === attributes[i].nodeName) { |
| 2823 | tokenizer._parseError("duplicate-attribute", {name: currentAttribute.nodeName}); |
| 2824 | currentAttribute.nodeName = null; |
| 2825 | break; |
| 2826 | } |
| 2827 | } |
| 2828 | if (shouldEmit) |
| 2829 | tokenizer._emitCurrentToken(); |
| 2830 | } else { |
| 2831 | buffer.commit(); |
| 2832 | } |
| 2833 | return true; |
| 2834 | } |
| 2835 | |
| 2836 | function after_attribute_name_state(buffer) { |
| 2837 | var data = buffer.char(); |
| 2838 | if (data === InputStream.EOF) { |
| 2839 | tokenizer._parseError("expected-end-of-tag-but-got-eof"); |
| 2840 | buffer.unget(data); |
| 2841 | tokenizer.setState(data_state); |
| 2842 | } else if (isWhitespace(data)) { |
| 2843 | return true; |
| 2844 | } else if (data === '=') { |
| 2845 | tokenizer.setState(before_attribute_value_state); |
| 2846 | } else if (data === '>') { |
| 2847 | tokenizer._emitCurrentToken(); |
| 2848 | } else if (isAlpha(data)) { |
| 2849 | tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""}); |
| 2850 | tokenizer.setState(attribute_name_state); |
| 2851 | } else if (data === '/') { |
| 2852 | tokenizer.setState(self_closing_tag_state); |
| 2853 | } else if (data === "'" || data === '"' || data === '<') { |
| 2854 | tokenizer._parseError("invalid-character-after-attribute-name"); |
| 2855 | tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""}); |
| 2856 | tokenizer.setState(attribute_name_state); |
| 2857 | } else if (data === '\u0000') { |
| 2858 | tokenizer._parseError("invalid-codepoint"); |
| 2859 | tokenizer._currentToken.data.push({nodeName: "\uFFFD", nodeValue: ""}); |
| 2860 | } else { |
| 2861 | tokenizer._currentToken.data.push({nodeName: data, nodeValue: ""}); |
| 2862 | tokenizer.setState(attribute_name_state); |
| 2863 | } |
| 2864 | return true; |
| 2865 | } |
| 2866 | |
| 2867 | function before_attribute_value_state(buffer) { |
| 2868 | var data = buffer.char(); |
| 2869 | if (data === InputStream.EOF) { |
| 2870 | tokenizer._parseError("expected-attribute-value-but-got-eof"); |
| 2871 | buffer.unget(data); |
| 2872 | tokenizer.setState(data_state); |
| 2873 | } else if (isWhitespace(data)) { |
| 2874 | return true; |
| 2875 | } else if (data === '"') { |
| 2876 | tokenizer.setState(attribute_value_double_quoted_state); |
| 2877 | } else if (data === '&') { |
| 2878 | tokenizer.setState(attribute_value_unquoted_state); |
| 2879 | buffer.unget(data); |
| 2880 | } else if (data === "'") { |
| 2881 | tokenizer.setState(attribute_value_single_quoted_state); |
| 2882 | } else if (data === '>') { |
| 2883 | tokenizer._parseError("expected-attribute-value-but-got-right-bracket"); |
| 2884 | tokenizer._emitCurrentToken(); |
| 2885 | } else if (data === '=' || data === '<' || data === '`') { |
| 2886 | tokenizer._parseError("unexpected-character-in-unquoted-attribute-value"); |
| 2887 | tokenizer._currentAttribute().nodeValue += data; |
| 2888 | tokenizer.setState(attribute_value_unquoted_state); |
| 2889 | } else if (data === '\u0000') { |
| 2890 | tokenizer._parseError("invalid-codepoint"); |
| 2891 | tokenizer._currentAttribute().nodeValue += "\uFFFD"; |
| 2892 | } else { |
| 2893 | tokenizer._currentAttribute().nodeValue += data; |
| 2894 | tokenizer.setState(attribute_value_unquoted_state); |
| 2895 | } |
| 2896 | |
| 2897 | return true; |
| 2898 | } |
| 2899 | |
| 2900 | function attribute_value_double_quoted_state(buffer) { |
| 2901 | var data = buffer.char(); |
| 2902 | if (data === InputStream.EOF) { |
| 2903 | tokenizer._parseError("eof-in-attribute-value-double-quote"); |
| 2904 | buffer.unget(data); |
| 2905 | tokenizer.setState(data_state); |
| 2906 | } else if (data === '"') { |
| 2907 | tokenizer.setState(after_attribute_value_state); |
| 2908 | } else if (data === '&') { |
| 2909 | this._additionalAllowedCharacter = '"'; |
| 2910 | tokenizer.setState(character_reference_in_attribute_value_state); |
| 2911 | } else if (data === '\u0000') { |
| 2912 | tokenizer._parseError("invalid-codepoint"); |
| 2913 | tokenizer._currentAttribute().nodeValue += "\uFFFD"; |
| 2914 | } else { |
| 2915 | var s = buffer.matchUntil('[\0"&]'); |
| 2916 | data = data + s; |
| 2917 | tokenizer._currentAttribute().nodeValue += data; |
| 2918 | } |
| 2919 | return true; |
| 2920 | } |
| 2921 | |
| 2922 | function attribute_value_single_quoted_state(buffer) { |
| 2923 | var data = buffer.char(); |
| 2924 | if (data === InputStream.EOF) { |
| 2925 | tokenizer._parseError("eof-in-attribute-value-single-quote"); |
| 2926 | buffer.unget(data); |
| 2927 | tokenizer.setState(data_state); |
| 2928 | } else if (data === "'") { |
| 2929 | tokenizer.setState(after_attribute_value_state); |
| 2930 | } else if (data === '&') { |
| 2931 | this._additionalAllowedCharacter = "'"; |
| 2932 | tokenizer.setState(character_reference_in_attribute_value_state); |
| 2933 | } else if (data === '\u0000') { |
| 2934 | tokenizer._parseError("invalid-codepoint"); |
| 2935 | tokenizer._currentAttribute().nodeValue += "\uFFFD"; |
| 2936 | } else { |
| 2937 | tokenizer._currentAttribute().nodeValue += data + buffer.matchUntil("\u0000|['&]"); |
| 2938 | } |
| 2939 | return true; |
| 2940 | } |
| 2941 | |
| 2942 | function attribute_value_unquoted_state(buffer) { |
| 2943 | var data = buffer.char(); |
| 2944 | if (data === InputStream.EOF) { |
| 2945 | tokenizer._parseError("eof-after-attribute-value"); |
| 2946 | buffer.unget(data); |
| 2947 | tokenizer.setState(data_state); |
| 2948 | } else if (isWhitespace(data)) { |
| 2949 | tokenizer.setState(before_attribute_name_state); |
| 2950 | } else if (data === '&') { |
| 2951 | this._additionalAllowedCharacter = ">"; |
| 2952 | tokenizer.setState(character_reference_in_attribute_value_state); |
| 2953 | } else if (data === '>') { |
| 2954 | tokenizer._emitCurrentToken(); |
| 2955 | } else if (data === '"' || data === "'" || data === '=' || data === '`' || data === '<') { |
| 2956 | tokenizer._parseError("unexpected-character-in-unquoted-attribute-value"); |
| 2957 | tokenizer._currentAttribute().nodeValue += data; |
| 2958 | buffer.commit(); |
| 2959 | } else if (data === '\u0000') { |
| 2960 | tokenizer._parseError("invalid-codepoint"); |
| 2961 | tokenizer._currentAttribute().nodeValue += "\uFFFD"; |
| 2962 | } else { |
| 2963 | var o = buffer.matchUntil("\u0000|["+ "\t\n\v\f\x20\r" + "&<>\"'=`" +"]"); |
| 2964 | if (o === InputStream.EOF) { |
| 2965 | tokenizer._parseError("eof-in-attribute-value-no-quotes"); |
| 2966 | tokenizer._emitCurrentToken(); |
| 2967 | } |
| 2968 | buffer.commit(); |
| 2969 | tokenizer._currentAttribute().nodeValue += data + o; |
| 2970 | } |
| 2971 | return true; |
| 2972 | } |
| 2973 | |
| 2974 | function character_reference_in_attribute_value_state(buffer) { |
| 2975 | var character = EntityParser.consumeEntity(buffer, tokenizer, this._additionalAllowedCharacter); |
| 2976 | this._currentAttribute().nodeValue += character || '&'; |
| 2977 | if (this._additionalAllowedCharacter === '"') |
| 2978 | tokenizer.setState(attribute_value_double_quoted_state); |
| 2979 | else if (this._additionalAllowedCharacter === '\'') |
| 2980 | tokenizer.setState(attribute_value_single_quoted_state); |
| 2981 | else if (this._additionalAllowedCharacter === '>') |
| 2982 | tokenizer.setState(attribute_value_unquoted_state); |
| 2983 | return true; |
| 2984 | } |
| 2985 | |
| 2986 | function after_attribute_value_state(buffer) { |
| 2987 | var data = buffer.char(); |
| 2988 | if (data === InputStream.EOF) { |
| 2989 | tokenizer._parseError("eof-after-attribute-value"); |
| 2990 | buffer.unget(data); |
| 2991 | tokenizer.setState(data_state); |
| 2992 | } else if (isWhitespace(data)) { |
| 2993 | tokenizer.setState(before_attribute_name_state); |
| 2994 | } else if (data === '>') { |
| 2995 | tokenizer.setState(data_state); |
| 2996 | tokenizer._emitCurrentToken(); |
| 2997 | } else if (data === '/') { |
| 2998 | tokenizer.setState(self_closing_tag_state); |
| 2999 | } else { |
| 3000 | tokenizer._parseError("unexpected-character-after-attribute-value"); |
| 3001 | buffer.unget(data); |
| 3002 | tokenizer.setState(before_attribute_name_state); |
| 3003 | } |
| 3004 | return true; |
| 3005 | } |
| 3006 | |
| 3007 | function self_closing_tag_state(buffer) { |
| 3008 | var c = buffer.char(); |
| 3009 | if (c === InputStream.EOF) { |
| 3010 | tokenizer._parseError("unexpected-eof-after-solidus-in-tag"); |
| 3011 | buffer.unget(c); |
| 3012 | tokenizer.setState(data_state); |
| 3013 | } else if (c === '>') { |
| 3014 | tokenizer._currentToken.selfClosing = true; |
| 3015 | tokenizer.setState(data_state); |
| 3016 | tokenizer._emitCurrentToken(); |
| 3017 | } else { |
| 3018 | tokenizer._parseError("unexpected-character-after-solidus-in-tag"); |
| 3019 | buffer.unget(c); |
| 3020 | tokenizer.setState(before_attribute_name_state); |
| 3021 | } |
| 3022 | return true; |
| 3023 | } |
| 3024 | |
| 3025 | function bogus_comment_state(buffer) { |
| 3026 | var data = buffer.matchUntil('>'); |
| 3027 | data = data.replace(/\u0000/g, "\uFFFD"); |
| 3028 | buffer.char(); |
| 3029 | tokenizer._emitToken({type: 'Comment', data: data}); |
| 3030 | tokenizer.setState(data_state); |
| 3031 | return true; |
| 3032 | } |
| 3033 | |
| 3034 | function markup_declaration_open_state(buffer) { |
| 3035 | var chars = buffer.shift(2); |
| 3036 | if (chars === '--') { |
| 3037 | tokenizer._currentToken = {type: 'Comment', data: ''}; |
| 3038 | tokenizer.setState(comment_start_state); |
| 3039 | } else { |
| 3040 | var newchars = buffer.shift(5); |
| 3041 | if (newchars === InputStream.EOF || chars === InputStream.EOF) { |
| 3042 | tokenizer._parseError("expected-dashes-or-doctype"); |
| 3043 | tokenizer.setState(bogus_comment_state); |
| 3044 | buffer.unget(chars); |
| 3045 | return true; |
| 3046 | } |
| 3047 | |
| 3048 | chars += newchars; |
| 3049 | if (chars.toUpperCase() === 'DOCTYPE') { |
| 3050 | tokenizer._currentToken = {type: 'Doctype', name: '', publicId: null, systemId: null, forceQuirks: false}; |
| 3051 | tokenizer.setState(doctype_state); |
| 3052 | } else if (tokenizer._tokenHandler.isCdataSectionAllowed() && chars === '[CDATA[') { |
| 3053 | tokenizer.setState(cdata_section_state); |
| 3054 | } else { |
| 3055 | tokenizer._parseError("expected-dashes-or-doctype"); |
| 3056 | buffer.unget(chars); |
| 3057 | tokenizer.setState(bogus_comment_state); |
| 3058 | } |
| 3059 | } |
| 3060 | return true; |
| 3061 | } |
| 3062 | |
| 3063 | function cdata_section_state(buffer) { |
| 3064 | var data = buffer.matchUntil(']]>'); |
| 3065 | buffer.shift(3); |
| 3066 | if (data) { |
| 3067 | tokenizer._emitToken({type: 'Characters', data: data}); |
| 3068 | } |
| 3069 | tokenizer.setState(data_state); |
| 3070 | return true; |
| 3071 | } |
| 3072 | |
| 3073 | function comment_start_state(buffer) { |
| 3074 | var data = buffer.char(); |
| 3075 | if (data === InputStream.EOF) { |
| 3076 | tokenizer._parseError("eof-in-comment"); |
| 3077 | tokenizer._emitToken(tokenizer._currentToken); |
| 3078 | buffer.unget(data); |
| 3079 | tokenizer.setState(data_state); |
| 3080 | } else if (data === '-') { |
| 3081 | tokenizer.setState(comment_start_dash_state); |
| 3082 | } else if (data === '>') { |
| 3083 | tokenizer._parseError("incorrect-comment"); |
| 3084 | tokenizer._emitToken(tokenizer._currentToken); |
| 3085 | tokenizer.setState(data_state); |
| 3086 | } else if (data === '\u0000') { |
| 3087 | tokenizer._parseError("invalid-codepoint"); |
| 3088 | tokenizer._currentToken.data += "\uFFFD"; |
| 3089 | } else { |
| 3090 | tokenizer._currentToken.data += data; |
| 3091 | tokenizer.setState(comment_state); |
| 3092 | } |
| 3093 | return true; |
| 3094 | } |
| 3095 | |
| 3096 | function comment_start_dash_state(buffer) { |
| 3097 | var data = buffer.char(); |
| 3098 | if (data === InputStream.EOF) { |
| 3099 | tokenizer._parseError("eof-in-comment"); |
| 3100 | tokenizer._emitToken(tokenizer._currentToken); |
| 3101 | buffer.unget(data); |
| 3102 | tokenizer.setState(data_state); |
| 3103 | } else if (data === '-') { |
| 3104 | tokenizer.setState(comment_end_state); |
| 3105 | } else if (data === '>') { |
| 3106 | tokenizer._parseError("incorrect-comment"); |
| 3107 | tokenizer._emitToken(tokenizer._currentToken); |
| 3108 | tokenizer.setState(data_state); |
| 3109 | } else if (data === '\u0000') { |
| 3110 | tokenizer._parseError("invalid-codepoint"); |
| 3111 | tokenizer._currentToken.data += "\uFFFD"; |
| 3112 | } else { |
| 3113 | tokenizer._currentToken.data += '-' + data; |
| 3114 | tokenizer.setState(comment_state); |
| 3115 | } |
| 3116 | return true; |
| 3117 | } |
| 3118 | |
| 3119 | function comment_state(buffer) { |
| 3120 | var data = buffer.char(); |
| 3121 | if (data === InputStream.EOF) { |
| 3122 | tokenizer._parseError("eof-in-comment"); |
| 3123 | tokenizer._emitToken(tokenizer._currentToken); |
| 3124 | buffer.unget(data); |
| 3125 | tokenizer.setState(data_state); |
| 3126 | } else if (data === '-') { |
| 3127 | tokenizer.setState(comment_end_dash_state); |
| 3128 | } else if (data === '\u0000') { |
| 3129 | tokenizer._parseError("invalid-codepoint"); |
| 3130 | tokenizer._currentToken.data += "\uFFFD"; |
| 3131 | } else { |
| 3132 | tokenizer._currentToken.data += data; |
| 3133 | buffer.commit(); |
| 3134 | } |
| 3135 | return true; |
| 3136 | } |
| 3137 | |
| 3138 | function comment_end_dash_state(buffer) { |
| 3139 | var data = buffer.char(); |
| 3140 | if (data === InputStream.EOF) { |
| 3141 | tokenizer._parseError("eof-in-comment-end-dash"); |
| 3142 | tokenizer._emitToken(tokenizer._currentToken); |
| 3143 | buffer.unget(data); |
| 3144 | tokenizer.setState(data_state); |
| 3145 | } else if (data === '-') { |
| 3146 | tokenizer.setState(comment_end_state); |
| 3147 | } else if (data === '\u0000') { |
| 3148 | tokenizer._parseError("invalid-codepoint"); |
| 3149 | tokenizer._currentToken.data += "-\uFFFD"; |
| 3150 | tokenizer.setState(comment_state); |
| 3151 | } else { |
| 3152 | tokenizer._currentToken.data += '-' + data + buffer.matchUntil('\u0000|-'); |
| 3153 | buffer.char(); |
| 3154 | } |
| 3155 | return true; |
| 3156 | } |
| 3157 | |
| 3158 | function comment_end_state(buffer) { |
| 3159 | var data = buffer.char(); |
| 3160 | if (data === InputStream.EOF) { |
| 3161 | tokenizer._parseError("eof-in-comment-double-dash"); |
| 3162 | tokenizer._emitToken(tokenizer._currentToken); |
| 3163 | buffer.unget(data); |
| 3164 | tokenizer.setState(data_state); |
| 3165 | } else if (data === '>') { |
| 3166 | tokenizer._emitToken(tokenizer._currentToken); |
| 3167 | tokenizer.setState(data_state); |
| 3168 | } else if (data === '!') { |
| 3169 | tokenizer._parseError("unexpected-bang-after-double-dash-in-comment"); |
| 3170 | tokenizer.setState(comment_end_bang_state); |
| 3171 | } else if (data === '-') { |
| 3172 | tokenizer._parseError("unexpected-dash-after-double-dash-in-comment"); |
| 3173 | tokenizer._currentToken.data += data; |
| 3174 | } else if (data === '\u0000') { |
| 3175 | tokenizer._parseError("invalid-codepoint"); |
| 3176 | tokenizer._currentToken.data += "--\uFFFD"; |
| 3177 | tokenizer.setState(comment_state); |
| 3178 | } else { |
| 3179 | tokenizer._parseError("unexpected-char-in-comment"); |
| 3180 | tokenizer._currentToken.data += '--' + data; |
| 3181 | tokenizer.setState(comment_state); |
| 3182 | } |
| 3183 | return true; |
| 3184 | } |
| 3185 | |
| 3186 | function comment_end_bang_state(buffer) { |
| 3187 | var data = buffer.char(); |
| 3188 | if (data === InputStream.EOF) { |
| 3189 | tokenizer._parseError("eof-in-comment-end-bang-state"); |
| 3190 | tokenizer._emitToken(tokenizer._currentToken); |
| 3191 | buffer.unget(data); |
| 3192 | tokenizer.setState(data_state); |
| 3193 | } else if (data === '>') { |
| 3194 | tokenizer._emitToken(tokenizer._currentToken); |
| 3195 | tokenizer.setState(data_state); |
| 3196 | } else if (data === '-') { |
| 3197 | tokenizer._currentToken.data += '--!'; |
| 3198 | tokenizer.setState(comment_end_dash_state); |
| 3199 | } else { |
| 3200 | tokenizer._currentToken.data += '--!' + data; |
| 3201 | tokenizer.setState(comment_state); |
| 3202 | } |
| 3203 | return true; |
| 3204 | } |
| 3205 | |
| 3206 | function doctype_state(buffer) { |
| 3207 | var data = buffer.char(); |
| 3208 | if (data === InputStream.EOF) { |
| 3209 | tokenizer._parseError("expected-doctype-name-but-got-eof"); |
| 3210 | tokenizer._currentToken.forceQuirks = true; |
| 3211 | buffer.unget(data); |
| 3212 | tokenizer.setState(data_state); |
| 3213 | tokenizer._emitCurrentToken(); |
| 3214 | } else if (isWhitespace(data)) { |
| 3215 | tokenizer.setState(before_doctype_name_state); |
| 3216 | } else { |
| 3217 | tokenizer._parseError("need-space-after-doctype"); |
| 3218 | buffer.unget(data); |
| 3219 | tokenizer.setState(before_doctype_name_state); |
| 3220 | } |
| 3221 | return true; |
| 3222 | } |
| 3223 | |
| 3224 | function before_doctype_name_state(buffer) { |
| 3225 | var data = buffer.char(); |
| 3226 | if (data === InputStream.EOF) { |
| 3227 | tokenizer._parseError("expected-doctype-name-but-got-eof"); |
| 3228 | tokenizer._currentToken.forceQuirks = true; |
| 3229 | buffer.unget(data); |
| 3230 | tokenizer.setState(data_state); |
| 3231 | tokenizer._emitCurrentToken(); |
| 3232 | } else if (isWhitespace(data)) { |
| 3233 | } else if (data === '>') { |
| 3234 | tokenizer._parseError("expected-doctype-name-but-got-right-bracket"); |
| 3235 | tokenizer._currentToken.forceQuirks = true; |
| 3236 | tokenizer.setState(data_state); |
| 3237 | tokenizer._emitCurrentToken(); |
| 3238 | } else { |
| 3239 | if (isAlpha(data)) |
| 3240 | data = data.toLowerCase(); |
| 3241 | tokenizer._currentToken.name = data; |
| 3242 | tokenizer.setState(doctype_name_state); |
| 3243 | } |
| 3244 | return true; |
| 3245 | } |
| 3246 | |
| 3247 | function doctype_name_state(buffer) { |
| 3248 | var data = buffer.char(); |
| 3249 | if (data === InputStream.EOF) { |
| 3250 | tokenizer._currentToken.forceQuirks = true; |
| 3251 | buffer.unget(data); |
| 3252 | tokenizer._parseError("eof-in-doctype-name"); |
| 3253 | tokenizer.setState(data_state); |
| 3254 | tokenizer._emitCurrentToken(); |
| 3255 | } else if (isWhitespace(data)) { |
| 3256 | tokenizer.setState(after_doctype_name_state); |
| 3257 | } else if (data === '>') { |
| 3258 | tokenizer.setState(data_state); |
| 3259 | tokenizer._emitCurrentToken(); |
| 3260 | } else { |
| 3261 | if (isAlpha(data)) |
| 3262 | data = data.toLowerCase(); |
| 3263 | tokenizer._currentToken.name += data; |
| 3264 | buffer.commit(); |
| 3265 | } |
| 3266 | return true; |
| 3267 | } |
| 3268 | |
| 3269 | function after_doctype_name_state(buffer) { |
| 3270 | var data = buffer.char(); |
| 3271 | if (data === InputStream.EOF) { |
| 3272 | tokenizer._currentToken.forceQuirks = true; |
| 3273 | buffer.unget(data); |
| 3274 | tokenizer._parseError("eof-in-doctype"); |
| 3275 | tokenizer.setState(data_state); |
| 3276 | tokenizer._emitCurrentToken(); |
| 3277 | } else if (isWhitespace(data)) { |
| 3278 | } else if (data === '>') { |
| 3279 | tokenizer.setState(data_state); |
| 3280 | tokenizer._emitCurrentToken(); |
| 3281 | } else { |
| 3282 | if (['p', 'P'].indexOf(data) > -1) { |
| 3283 | var expected = [['u', 'U'], ['b', 'B'], ['l', 'L'], ['i', 'I'], ['c', 'C']]; |
| 3284 | var matched = expected.every(function(expected){ |
| 3285 | data = buffer.char(); |
| 3286 | return expected.indexOf(data) > -1; |
| 3287 | }); |
| 3288 | if (matched) { |
| 3289 | tokenizer.setState(after_doctype_public_keyword_state); |
| 3290 | return true; |
| 3291 | } |
| 3292 | } else if (['s', 'S'].indexOf(data) > -1) { |
| 3293 | var expected = [['y', 'Y'], ['s', 'S'], ['t', 'T'], ['e', 'E'], ['m', 'M']]; |
| 3294 | var matched = expected.every(function(expected){ |
| 3295 | data = buffer.char(); |
| 3296 | return expected.indexOf(data) > -1; |
| 3297 | }); |
| 3298 | if (matched) { |
| 3299 | tokenizer.setState(after_doctype_system_keyword_state); |
| 3300 | return true; |
| 3301 | } |
| 3302 | } |
| 3303 | buffer.unget(data); |
| 3304 | tokenizer._currentToken.forceQuirks = true; |
| 3305 | |
| 3306 | if (data === InputStream.EOF) { |
| 3307 | tokenizer._parseError("eof-in-doctype"); |
| 3308 | buffer.unget(data); |
| 3309 | tokenizer.setState(data_state); |
| 3310 | tokenizer._emitCurrentToken(); |
| 3311 | } else { |
| 3312 | tokenizer._parseError("expected-space-or-right-bracket-in-doctype", {data: data}); |
| 3313 | tokenizer.setState(bogus_doctype_state); |
| 3314 | } |
| 3315 | } |
| 3316 | return true; |
| 3317 | } |
| 3318 | |
| 3319 | function after_doctype_public_keyword_state(buffer) { |
| 3320 | var data = buffer.char(); |
| 3321 | if (data === InputStream.EOF) { |
| 3322 | tokenizer._parseError("eof-in-doctype"); |
| 3323 | tokenizer._currentToken.forceQuirks = true; |
| 3324 | buffer.unget(data); |
| 3325 | tokenizer.setState(data_state); |
| 3326 | tokenizer._emitCurrentToken(); |
| 3327 | } else if (isWhitespace(data)) { |
| 3328 | tokenizer.setState(before_doctype_public_identifier_state); |
| 3329 | } else if (data === "'" || data === '"') { |
| 3330 | tokenizer._parseError("unexpected-char-in-doctype"); |
| 3331 | buffer.unget(data); |
| 3332 | tokenizer.setState(before_doctype_public_identifier_state); |
| 3333 | } else { |
| 3334 | buffer.unget(data); |
| 3335 | tokenizer.setState(before_doctype_public_identifier_state); |
| 3336 | } |
| 3337 | return true; |
| 3338 | } |
| 3339 | |
| 3340 | function before_doctype_public_identifier_state(buffer) { |
| 3341 | var data = buffer.char(); |
| 3342 | if (data === InputStream.EOF) { |
| 3343 | tokenizer._parseError("eof-in-doctype"); |
| 3344 | tokenizer._currentToken.forceQuirks = true; |
| 3345 | buffer.unget(data); |
| 3346 | tokenizer.setState(data_state); |
| 3347 | tokenizer._emitCurrentToken(); |
| 3348 | } else if (isWhitespace(data)) { |
| 3349 | } else if (data === '"') { |
| 3350 | tokenizer._currentToken.publicId = ''; |
| 3351 | tokenizer.setState(doctype_public_identifier_double_quoted_state); |
| 3352 | } else if (data === "'") { |
| 3353 | tokenizer._currentToken.publicId = ''; |
| 3354 | tokenizer.setState(doctype_public_identifier_single_quoted_state); |
| 3355 | } else if (data === '>') { |
| 3356 | tokenizer._parseError("unexpected-end-of-doctype"); |
| 3357 | tokenizer._currentToken.forceQuirks = true; |
| 3358 | tokenizer.setState(data_state); |
| 3359 | tokenizer._emitCurrentToken(); |
| 3360 | } else { |
| 3361 | tokenizer._parseError("unexpected-char-in-doctype"); |
| 3362 | tokenizer._currentToken.forceQuirks = true; |
| 3363 | tokenizer.setState(bogus_doctype_state); |
| 3364 | } |
| 3365 | return true; |
| 3366 | } |
| 3367 | |
| 3368 | function doctype_public_identifier_double_quoted_state(buffer) { |
| 3369 | var data = buffer.char(); |
| 3370 | if (data === InputStream.EOF) { |
| 3371 | tokenizer._parseError("eof-in-doctype"); |
| 3372 | tokenizer._currentToken.forceQuirks = true; |
| 3373 | buffer.unget(data); |
| 3374 | tokenizer.setState(data_state); |
| 3375 | tokenizer._emitCurrentToken(); |
| 3376 | } else if (data === '"') { |
| 3377 | tokenizer.setState(after_doctype_public_identifier_state); |
| 3378 | } else if (data === '>') { |
| 3379 | tokenizer._parseError("unexpected-end-of-doctype"); |
| 3380 | tokenizer._currentToken.forceQuirks = true; |
| 3381 | tokenizer.setState(data_state); |
| 3382 | tokenizer._emitCurrentToken(); |
| 3383 | } else { |
| 3384 | tokenizer._currentToken.publicId += data; |
| 3385 | } |
| 3386 | return true; |
| 3387 | } |
| 3388 | |
| 3389 | function doctype_public_identifier_single_quoted_state(buffer) { |
| 3390 | var data = buffer.char(); |
| 3391 | if (data === InputStream.EOF) { |
| 3392 | tokenizer._parseError("eof-in-doctype"); |
| 3393 | tokenizer._currentToken.forceQuirks = true; |
| 3394 | buffer.unget(data); |
| 3395 | tokenizer.setState(data_state); |
| 3396 | tokenizer._emitCurrentToken(); |
| 3397 | } else if (data === "'") { |
| 3398 | tokenizer.setState(after_doctype_public_identifier_state); |
| 3399 | } else if (data === '>') { |
| 3400 | tokenizer._parseError("unexpected-end-of-doctype"); |
| 3401 | tokenizer._currentToken.forceQuirks = true; |
| 3402 | tokenizer.setState(data_state); |
| 3403 | tokenizer._emitCurrentToken(); |
| 3404 | } else { |
| 3405 | tokenizer._currentToken.publicId += data; |
| 3406 | } |
| 3407 | return true; |
| 3408 | } |
| 3409 | |
| 3410 | function after_doctype_public_identifier_state(buffer) { |
| 3411 | var data = buffer.char(); |
| 3412 | if (data === InputStream.EOF) { |
| 3413 | tokenizer._parseError("eof-in-doctype"); |
| 3414 | tokenizer._currentToken.forceQuirks = true; |
| 3415 | tokenizer._emitCurrentToken(); |
| 3416 | buffer.unget(data); |
| 3417 | tokenizer.setState(data_state); |
| 3418 | } else if (isWhitespace(data)) { |
| 3419 | tokenizer.setState(between_doctype_public_and_system_identifiers_state); |
| 3420 | } else if (data === '>') { |
| 3421 | tokenizer.setState(data_state); |
| 3422 | tokenizer._emitCurrentToken(); |
| 3423 | } else if (data === '"') { |
| 3424 | tokenizer._parseError("unexpected-char-in-doctype"); |
| 3425 | tokenizer._currentToken.systemId = ''; |
| 3426 | tokenizer.setState(doctype_system_identifier_double_quoted_state); |
| 3427 | } else if (data === "'") { |
| 3428 | tokenizer._parseError("unexpected-char-in-doctype"); |
| 3429 | tokenizer._currentToken.systemId = ''; |
| 3430 | tokenizer.setState(doctype_system_identifier_single_quoted_state); |
| 3431 | } else { |
| 3432 | tokenizer._parseError("unexpected-char-in-doctype"); |
| 3433 | tokenizer._currentToken.forceQuirks = true; |
| 3434 | tokenizer.setState(bogus_doctype_state); |
| 3435 | } |
| 3436 | return true; |
| 3437 | } |
| 3438 | |
| 3439 | function between_doctype_public_and_system_identifiers_state(buffer) { |
| 3440 | var data = buffer.char(); |
| 3441 | if (data === InputStream.EOF) { |
| 3442 | tokenizer._parseError("eof-in-doctype"); |
| 3443 | tokenizer._currentToken.forceQuirks = true; |
| 3444 | tokenizer._emitCurrentToken(); |
| 3445 | buffer.unget(data); |
| 3446 | tokenizer.setState(data_state); |
| 3447 | } else if (isWhitespace(data)) { |
| 3448 | } else if (data === '>') { |
| 3449 | tokenizer._emitCurrentToken(); |
| 3450 | tokenizer.setState(data_state); |
| 3451 | } else if (data === '"') { |
| 3452 | tokenizer._currentToken.systemId = ''; |
| 3453 | tokenizer.setState(doctype_system_identifier_double_quoted_state); |
| 3454 | } else if (data === "'") { |
| 3455 | tokenizer._currentToken.systemId = ''; |
| 3456 | tokenizer.setState(doctype_system_identifier_single_quoted_state); |
| 3457 | } else { |
| 3458 | tokenizer._parseError("unexpected-char-in-doctype"); |
| 3459 | tokenizer._currentToken.forceQuirks = true; |
| 3460 | tokenizer.setState(bogus_doctype_state); |
| 3461 | } |
| 3462 | return true; |
| 3463 | } |
| 3464 | |
| 3465 | function after_doctype_system_keyword_state(buffer) { |
| 3466 | var data = buffer.char(); |
| 3467 | if (data === InputStream.EOF) { |
| 3468 | tokenizer._parseError("eof-in-doctype"); |
| 3469 | tokenizer._currentToken.forceQuirks = true; |
| 3470 | tokenizer._emitCurrentToken(); |
| 3471 | buffer.unget(data); |
| 3472 | tokenizer.setState(data_state); |
| 3473 | } else if (isWhitespace(data)) { |
| 3474 | tokenizer.setState(before_doctype_system_identifier_state); |
| 3475 | } else if (data === "'" || data === '"') { |
| 3476 | tokenizer._parseError("unexpected-char-in-doctype"); |
| 3477 | buffer.unget(data); |
| 3478 | tokenizer.setState(before_doctype_system_identifier_state); |
| 3479 | } else { |
| 3480 | buffer.unget(data); |
| 3481 | tokenizer.setState(before_doctype_system_identifier_state); |
| 3482 | } |
| 3483 | return true; |
| 3484 | } |
| 3485 | |
| 3486 | function before_doctype_system_identifier_state(buffer) { |
| 3487 | var data = buffer.char(); |
| 3488 | if (data === InputStream.EOF) { |
| 3489 | tokenizer._parseError("eof-in-doctype"); |
| 3490 | tokenizer._currentToken.forceQuirks = true; |
| 3491 | tokenizer._emitCurrentToken(); |
| 3492 | buffer.unget(data); |
| 3493 | tokenizer.setState(data_state); |
| 3494 | } else if (isWhitespace(data)) { |
| 3495 | } else if (data === '"') { |
| 3496 | tokenizer._currentToken.systemId = ''; |
| 3497 | tokenizer.setState(doctype_system_identifier_double_quoted_state); |
| 3498 | } else if (data === "'") { |
| 3499 | tokenizer._currentToken.systemId = ''; |
| 3500 | tokenizer.setState(doctype_system_identifier_single_quoted_state); |
| 3501 | } else if (data === '>') { |
| 3502 | tokenizer._parseError("unexpected-end-of-doctype"); |
| 3503 | tokenizer._currentToken.forceQuirks = true; |
| 3504 | tokenizer._emitCurrentToken(); |
| 3505 | tokenizer.setState(data_state); |
| 3506 | } else { |
| 3507 | tokenizer._parseError("unexpected-char-in-doctype"); |
| 3508 | tokenizer._currentToken.forceQuirks = true; |
| 3509 | tokenizer.setState(bogus_doctype_state); |
| 3510 | } |
| 3511 | return true; |
| 3512 | } |
| 3513 | |
| 3514 | function doctype_system_identifier_double_quoted_state(buffer) { |
| 3515 | var data = buffer.char(); |
| 3516 | if (data === InputStream.EOF) { |
| 3517 | tokenizer._parseError("eof-in-doctype"); |
| 3518 | tokenizer._currentToken.forceQuirks = true; |
| 3519 | tokenizer._emitCurrentToken(); |
| 3520 | buffer.unget(data); |
| 3521 | tokenizer.setState(data_state); |
| 3522 | } else if (data === '"') { |
| 3523 | tokenizer.setState(after_doctype_system_identifier_state); |
| 3524 | } else if (data === '>') { |
| 3525 | tokenizer._parseError("unexpected-end-of-doctype"); |
| 3526 | tokenizer._currentToken.forceQuirks = true; |
| 3527 | tokenizer._emitCurrentToken(); |
| 3528 | tokenizer.setState(data_state); |
| 3529 | } else { |
| 3530 | tokenizer._currentToken.systemId += data; |
| 3531 | } |
| 3532 | return true; |
| 3533 | } |
| 3534 | |
| 3535 | function doctype_system_identifier_single_quoted_state(buffer) { |
| 3536 | var data = buffer.char(); |
| 3537 | if (data === InputStream.EOF) { |
| 3538 | tokenizer._parseError("eof-in-doctype"); |
| 3539 | tokenizer._currentToken.forceQuirks = true; |
| 3540 | tokenizer._emitCurrentToken(); |
| 3541 | buffer.unget(data); |
| 3542 | tokenizer.setState(data_state); |
| 3543 | } else if (data === "'") { |
| 3544 | tokenizer.setState(after_doctype_system_identifier_state); |
| 3545 | } else if (data === '>') { |
| 3546 | tokenizer._parseError("unexpected-end-of-doctype"); |
| 3547 | tokenizer._currentToken.forceQuirks = true; |
| 3548 | tokenizer._emitCurrentToken(); |
| 3549 | tokenizer.setState(data_state); |
| 3550 | } else { |
| 3551 | tokenizer._currentToken.systemId += data; |
| 3552 | } |
| 3553 | return true; |
| 3554 | } |
| 3555 | |
| 3556 | function after_doctype_system_identifier_state(buffer) { |
| 3557 | var data = buffer.char(); |
| 3558 | if (data === InputStream.EOF) { |
| 3559 | tokenizer._parseError("eof-in-doctype"); |
| 3560 | tokenizer._currentToken.forceQuirks = true; |
| 3561 | tokenizer._emitCurrentToken(); |
| 3562 | buffer.unget(data); |
| 3563 | tokenizer.setState(data_state); |
| 3564 | } else if (isWhitespace(data)) { |
| 3565 | } else if (data === '>') { |
| 3566 | tokenizer._emitCurrentToken(); |
| 3567 | tokenizer.setState(data_state); |
| 3568 | } else { |
| 3569 | tokenizer._parseError("unexpected-char-in-doctype"); |
| 3570 | tokenizer.setState(bogus_doctype_state); |
| 3571 | } |
| 3572 | return true; |
| 3573 | } |
| 3574 | |
| 3575 | function bogus_doctype_state(buffer) { |
| 3576 | var data = buffer.char(); |
| 3577 | if (data === InputStream.EOF) { |
| 3578 | buffer.unget(data); |
| 3579 | tokenizer._emitCurrentToken(); |
| 3580 | tokenizer.setState(data_state); |
| 3581 | } else if (data === '>') { |
| 3582 | tokenizer._emitCurrentToken(); |
| 3583 | tokenizer.setState(data_state); |
| 3584 | } |
| 3585 | return true; |
| 3586 | } |
| 3587 | }; |
| 3588 | |
| 3589 | Object.defineProperty(Tokenizer.prototype, 'lineNumber', { |
| 3590 | get: function() { |
| 3591 | return this._inputStream.location().line; |
| 3592 | } |
| 3593 | }); |
| 3594 | |
| 3595 | Object.defineProperty(Tokenizer.prototype, 'columnNumber', { |
| 3596 | get: function() { |
| 3597 | return this._inputStream.location().column; |
| 3598 | } |
| 3599 | }); |
| 3600 | |
| 3601 | exports.Tokenizer = Tokenizer; |
| 3602 | |
| 3603 | }, |
| 3604 | {"./EntityParser":2,"./InputStream":3}], |
| 3605 | 6:[function(_dereq_,module,exports){ |
| 3606 | var assert = _dereq_('assert'); |
| 3607 | |
| 3608 | var messages = _dereq_('./messages.json'); |
| 3609 | var constants = _dereq_('./constants'); |
| 3610 | |
| 3611 | var EventEmitter = _dereq_('events').EventEmitter; |
| 3612 | |
| 3613 | var Tokenizer = _dereq_('./Tokenizer').Tokenizer; |
| 3614 | var ElementStack = _dereq_('./ElementStack').ElementStack; |
| 3615 | var StackItem = _dereq_('./StackItem').StackItem; |
| 3616 | |
| 3617 | var Marker = {}; |
| 3618 | |
| 3619 | function isWhitespace(ch) { |
| 3620 | return ch === " " || ch === "\n" || ch === "\t" || ch === "\r" || ch === "\f"; |
| 3621 | } |
| 3622 | |
| 3623 | function isWhitespaceOrReplacementCharacter(ch) { |
| 3624 | return isWhitespace(ch) || ch === '\uFFFD'; |
| 3625 | } |
| 3626 | |
| 3627 | function isAllWhitespace(characters) { |
| 3628 | for (var i = 0; i < characters.length; i++) { |
| 3629 | var ch = characters[i]; |
| 3630 | if (!isWhitespace(ch)) |
| 3631 | return false; |
| 3632 | } |
| 3633 | return true; |
| 3634 | } |
| 3635 | |
| 3636 | function isAllWhitespaceOrReplacementCharacters(characters) { |
| 3637 | for (var i = 0; i < characters.length; i++) { |
| 3638 | var ch = characters[i]; |
| 3639 | if (!isWhitespaceOrReplacementCharacter(ch)) |
| 3640 | return false; |
| 3641 | } |
| 3642 | return true; |
| 3643 | } |
| 3644 | |
| 3645 | function getAttribute(node, name) { |
| 3646 | for (var i = 0; i < node.attributes.length; i++) { |
| 3647 | var attribute = node.attributes[i]; |
| 3648 | if (attribute.nodeName === name) { |
| 3649 | return attribute; |
| 3650 | } |
| 3651 | } |
| 3652 | return null; |
| 3653 | } |
| 3654 | |
| 3655 | function CharacterBuffer(characters) { |
| 3656 | this.characters = characters; |
| 3657 | this.current = 0; |
| 3658 | this.end = this.characters.length; |
| 3659 | } |
| 3660 | |
| 3661 | CharacterBuffer.prototype.skipAtMostOneLeadingNewline = function() { |
| 3662 | if (this.characters[this.current] === '\n') |
| 3663 | this.current++; |
| 3664 | }; |
| 3665 | |
| 3666 | CharacterBuffer.prototype.skipLeadingWhitespace = function() { |
| 3667 | while (isWhitespace(this.characters[this.current])) { |
| 3668 | if (++this.current == this.end) |
| 3669 | return; |
| 3670 | } |
| 3671 | }; |
| 3672 | |
| 3673 | CharacterBuffer.prototype.skipLeadingNonWhitespace = function() { |
| 3674 | while (!isWhitespace(this.characters[this.current])) { |
| 3675 | if (++this.current == this.end) |
| 3676 | return; |
| 3677 | } |
| 3678 | }; |
| 3679 | |
| 3680 | CharacterBuffer.prototype.takeRemaining = function() { |
| 3681 | return this.characters.substring(this.current); |
| 3682 | }; |
| 3683 | |
| 3684 | CharacterBuffer.prototype.takeLeadingWhitespace = function() { |
| 3685 | var start = this.current; |
| 3686 | this.skipLeadingWhitespace(); |
| 3687 | if (start === this.current) |
| 3688 | return ""; |
| 3689 | return this.characters.substring(start, this.current - start); |
| 3690 | }; |
| 3691 | |
| 3692 | Object.defineProperty(CharacterBuffer.prototype, 'length', { |
| 3693 | get: function(){ |
| 3694 | return this.end - this.current; |
| 3695 | } |
| 3696 | }); |
| 3697 | function TreeBuilder() { |
| 3698 | this.tokenizer = null; |
| 3699 | this.errorHandler = null; |
| 3700 | this.scriptingEnabled = false; |
| 3701 | this.document = null; |
| 3702 | this.head = null; |
| 3703 | this.form = null; |
| 3704 | this.openElements = new ElementStack(); |
| 3705 | this.activeFormattingElements = []; |
| 3706 | this.insertionMode = null; |
| 3707 | this.insertionModeName = ""; |
| 3708 | this.originalInsertionMode = ""; |
| 3709 | this.inQuirksMode = false; // TODO quirks mode |
| 3710 | this.compatMode = "no quirks"; |
| 3711 | this.framesetOk = true; |
| 3712 | this.redirectAttachToFosterParent = false; |
| 3713 | this.selfClosingFlagAcknowledged = false; |
| 3714 | this.context = ""; |
| 3715 | this.pendingTableCharacters = []; |
| 3716 | this.shouldSkipLeadingNewline = false; |
| 3717 | |
| 3718 | var tree = this; |
| 3719 | var modes = this.insertionModes = {}; |
| 3720 | modes.base = { |
| 3721 | end_tag_handlers: {"-default": 'endTagOther'}, |
| 3722 | start_tag_handlers: {"-default": 'startTagOther'}, |
| 3723 | processEOF: function() { |
| 3724 | tree.generateImpliedEndTags(); |
| 3725 | if (tree.openElements.length > 2) { |
| 3726 | tree.parseError('expected-closing-tag-but-got-eof'); |
| 3727 | } else if (tree.openElements.length == 2 && |
| 3728 | tree.openElements.item(1).localName != 'body') { |
| 3729 | tree.parseError('expected-closing-tag-but-got-eof'); |
| 3730 | } else if (tree.context && tree.openElements.length > 1) { |
| 3731 | } |
| 3732 | }, |
| 3733 | processComment: function(data) { |
| 3734 | tree.insertComment(data, tree.currentStackItem().node); |
| 3735 | }, |
| 3736 | processDoctype: function(name, publicId, systemId, forceQuirks) { |
| 3737 | tree.parseError('unexpected-doctype'); |
| 3738 | }, |
| 3739 | processStartTag: function(name, attributes, selfClosing) { |
| 3740 | if (this[this.start_tag_handlers[name]]) { |
| 3741 | this[this.start_tag_handlers[name]](name, attributes, selfClosing); |
| 3742 | } else if (this[this.start_tag_handlers["-default"]]) { |
| 3743 | this[this.start_tag_handlers["-default"]](name, attributes, selfClosing); |
| 3744 | } else { |
| 3745 | throw(new Error("No handler found for "+name)); |
| 3746 | } |
| 3747 | }, |
| 3748 | processEndTag: function(name) { |
| 3749 | if (this[this.end_tag_handlers[name]]) { |
| 3750 | this[this.end_tag_handlers[name]](name); |
| 3751 | } else if (this[this.end_tag_handlers["-default"]]) { |
| 3752 | this[this.end_tag_handlers["-default"]](name); |
| 3753 | } else { |
| 3754 | throw(new Error("No handler found for "+name)); |
| 3755 | } |
| 3756 | }, |
| 3757 | startTagHtml: function(name, attributes) { |
| 3758 | modes.inBody.startTagHtml(name, attributes); |
| 3759 | } |
| 3760 | }; |
| 3761 | |
| 3762 | modes.initial = Object.create(modes.base); |
| 3763 | |
| 3764 | modes.initial.processEOF = function() { |
| 3765 | tree.parseError("expected-doctype-but-got-eof"); |
| 3766 | this.anythingElse(); |
| 3767 | tree.insertionMode.processEOF(); |
| 3768 | }; |
| 3769 | |
| 3770 | modes.initial.processComment = function(data) { |
| 3771 | tree.insertComment(data, tree.document); |
| 3772 | }; |
| 3773 | |
| 3774 | modes.initial.processDoctype = function(name, publicId, systemId, forceQuirks) { |
| 3775 | tree.insertDoctype(name || '', publicId || '', systemId || ''); |
| 3776 | |
| 3777 | if (forceQuirks || name != 'html' || (publicId != null && ([ |
| 3778 | "+//silmaril//dtd html pro v0r11 19970101//", |
| 3779 | "-//advasoft ltd//dtd html 3.0 aswedit + extensions//", |
| 3780 | "-//as//dtd html 3.0 aswedit + extensions//", |
| 3781 | "-//ietf//dtd html 2.0 level 1//", |
| 3782 | "-//ietf//dtd html 2.0 level 2//", |
| 3783 | "-//ietf//dtd html 2.0 strict level 1//", |
| 3784 | "-//ietf//dtd html 2.0 strict level 2//", |
| 3785 | "-//ietf//dtd html 2.0 strict//", |
| 3786 | "-//ietf//dtd html 2.0//", |
| 3787 | "-//ietf//dtd html 2.1e//", |
| 3788 | "-//ietf//dtd html 3.0//", |
| 3789 | "-//ietf//dtd html 3.0//", |
| 3790 | "-//ietf//dtd html 3.2 final//", |
| 3791 | "-//ietf//dtd html 3.2//", |
| 3792 | "-//ietf//dtd html 3//", |
| 3793 | "-//ietf//dtd html level 0//", |
| 3794 | "-//ietf//dtd html level 0//", |
| 3795 | "-//ietf//dtd html level 1//", |
| 3796 | "-//ietf//dtd html level 1//", |
| 3797 | "-//ietf//dtd html level 2//", |
| 3798 | "-//ietf//dtd html level 2//", |
| 3799 | "-//ietf//dtd html level 3//", |
| 3800 | "-//ietf//dtd html level 3//", |
| 3801 | "-//ietf//dtd html strict level 0//", |
| 3802 | "-//ietf//dtd html strict level 0//", |
| 3803 | "-//ietf//dtd html strict level 1//", |
| 3804 | "-//ietf//dtd html strict level 1//", |
| 3805 | "-//ietf//dtd html strict level 2//", |
| 3806 | "-//ietf//dtd html strict level 2//", |
| 3807 | "-//ietf//dtd html strict level 3//", |
| 3808 | "-//ietf//dtd html strict level 3//", |
| 3809 | "-//ietf//dtd html strict//", |
| 3810 | "-//ietf//dtd html strict//", |
| 3811 | "-//ietf//dtd html strict//", |
| 3812 | "-//ietf//dtd html//", |
| 3813 | "-//ietf//dtd html//", |
| 3814 | "-//ietf//dtd html//", |
| 3815 | "-//metrius//dtd metrius presentational//", |
| 3816 | "-//microsoft//dtd internet explorer 2.0 html strict//", |
| 3817 | "-//microsoft//dtd internet explorer 2.0 html//", |
| 3818 | "-//microsoft//dtd internet explorer 2.0 tables//", |
| 3819 | "-//microsoft//dtd internet explorer 3.0 html strict//", |
| 3820 | "-//microsoft//dtd internet explorer 3.0 html//", |
| 3821 | "-//microsoft//dtd internet explorer 3.0 tables//", |
| 3822 | "-//netscape comm. corp.//dtd html//", |
| 3823 | "-//netscape comm. corp.//dtd strict html//", |
| 3824 | "-//o'reilly and associates//dtd html 2.0//", |
| 3825 | "-//o'reilly and associates//dtd html extended 1.0//", |
| 3826 | "-//spyglass//dtd html 2.0 extended//", |
| 3827 | "-//sq//dtd html 2.0 hotmetal + extensions//", |
| 3828 | "-//sun microsystems corp.//dtd hotjava html//", |
| 3829 | "-//sun microsystems corp.//dtd hotjava strict html//", |
| 3830 | "-//w3c//dtd html 3 1995-03-24//", |
| 3831 | "-//w3c//dtd html 3.2 draft//", |
| 3832 | "-//w3c//dtd html 3.2 final//", |
| 3833 | "-//w3c//dtd html 3.2//", |
| 3834 | "-//w3c//dtd html 3.2s draft//", |
| 3835 | "-//w3c//dtd html 4.0 frameset//", |
| 3836 | "-//w3c//dtd html 4.0 transitional//", |
| 3837 | "-//w3c//dtd html experimental 19960712//", |
| 3838 | "-//w3c//dtd html experimental 970421//", |
| 3839 | "-//w3c//dtd w3 html//", |
| 3840 | "-//w3o//dtd w3 html 3.0//", |
| 3841 | "-//webtechs//dtd mozilla html 2.0//", |
| 3842 | "-//webtechs//dtd mozilla html//", |
| 3843 | "html" |
| 3844 | ].some(publicIdStartsWith) |
| 3845 | || [ |
| 3846 | "-//w3o//dtd w3 html strict 3.0//en//", |
| 3847 | "-/w3c/dtd html 4.0 transitional/en", |
| 3848 | "html" |
| 3849 | ].indexOf(publicId.toLowerCase()) > -1 |
| 3850 | || (systemId == null && [ |
| 3851 | "-//w3c//dtd html 4.01 transitional//", |
| 3852 | "-//w3c//dtd html 4.01 frameset//" |
| 3853 | ].some(publicIdStartsWith))) |
| 3854 | ) |
| 3855 | || (systemId != null && (systemId.toLowerCase() == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd")) |
| 3856 | ) { |
| 3857 | tree.compatMode = "quirks"; |
| 3858 | tree.parseError("quirky-doctype"); |
| 3859 | } else if (publicId != null && ([ |
| 3860 | "-//w3c//dtd xhtml 1.0 transitional//", |
| 3861 | "-//w3c//dtd xhtml 1.0 frameset//" |
| 3862 | ].some(publicIdStartsWith) |
| 3863 | || (systemId != null && [ |
| 3864 | "-//w3c//dtd html 4.01 transitional//", |
| 3865 | "-//w3c//dtd html 4.01 frameset//" |
| 3866 | ].indexOf(publicId.toLowerCase()) > -1)) |
| 3867 | ) { |
| 3868 | tree.compatMode = "limited quirks"; |
| 3869 | tree.parseError("almost-standards-doctype"); |
| 3870 | } else { |
| 3871 | if ((publicId == "-//W3C//DTD HTML 4.0//EN" && (systemId == null || systemId == "http://www.w3.org/TR/REC-html40/strict.dtd")) |
| 3872 | || (publicId == "-//W3C//DTD HTML 4.01//EN" && (systemId == null || systemId == "http://www.w3.org/TR/html4/strict.dtd")) |
| 3873 | || (publicId == "-//W3C//DTD XHTML 1.0 Strict//EN" && (systemId == "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd")) |
| 3874 | || (publicId == "-//W3C//DTD XHTML 1.1//EN" && (systemId == "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd")) |
| 3875 | ) { |
| 3876 | } else if (!((systemId == null || systemId == "about:legacy-compat") && publicId == null)) { |
| 3877 | tree.parseError("unknown-doctype"); |
| 3878 | } |
| 3879 | } |
| 3880 | tree.setInsertionMode('beforeHTML'); |
| 3881 | function publicIdStartsWith(string) { |
| 3882 | return publicId.toLowerCase().indexOf(string) === 0; |
| 3883 | } |
| 3884 | }; |
| 3885 | |
| 3886 | modes.initial.processCharacters = function(buffer) { |
| 3887 | buffer.skipLeadingWhitespace(); |
| 3888 | if (!buffer.length) |
| 3889 | return; |
| 3890 | tree.parseError('expected-doctype-but-got-chars'); |
| 3891 | this.anythingElse(); |
| 3892 | tree.insertionMode.processCharacters(buffer); |
| 3893 | }; |
| 3894 | |
| 3895 | modes.initial.processStartTag = function(name, attributes, selfClosing) { |
| 3896 | tree.parseError('expected-doctype-but-got-start-tag', {name: name}); |
| 3897 | this.anythingElse(); |
| 3898 | tree.insertionMode.processStartTag(name, attributes, selfClosing); |
| 3899 | }; |
| 3900 | |
| 3901 | modes.initial.processEndTag = function(name) { |
| 3902 | tree.parseError('expected-doctype-but-got-end-tag', {name: name}); |
| 3903 | this.anythingElse(); |
| 3904 | tree.insertionMode.processEndTag(name); |
| 3905 | }; |
| 3906 | |
| 3907 | modes.initial.anythingElse = function() { |
| 3908 | tree.compatMode = 'quirks'; |
| 3909 | tree.setInsertionMode('beforeHTML'); |
| 3910 | }; |
| 3911 | |
| 3912 | modes.beforeHTML = Object.create(modes.base); |
| 3913 | |
| 3914 | modes.beforeHTML.start_tag_handlers = { |
| 3915 | html: 'startTagHtml', |
| 3916 | '-default': 'startTagOther' |
| 3917 | }; |
| 3918 | |
| 3919 | modes.beforeHTML.processEOF = function() { |
| 3920 | this.anythingElse(); |
| 3921 | tree.insertionMode.processEOF(); |
| 3922 | }; |
| 3923 | |
| 3924 | modes.beforeHTML.processComment = function(data) { |
| 3925 | tree.insertComment(data, tree.document); |
| 3926 | }; |
| 3927 | |
| 3928 | modes.beforeHTML.processCharacters = function(buffer) { |
| 3929 | buffer.skipLeadingWhitespace(); |
| 3930 | if (!buffer.length) |
| 3931 | return; |
| 3932 | this.anythingElse(); |
| 3933 | tree.insertionMode.processCharacters(buffer); |
| 3934 | }; |
| 3935 | |
| 3936 | modes.beforeHTML.startTagHtml = function(name, attributes, selfClosing) { |
| 3937 | tree.insertHtmlElement(attributes); |
| 3938 | tree.setInsertionMode('beforeHead'); |
| 3939 | }; |
| 3940 | |
| 3941 | modes.beforeHTML.startTagOther = function(name, attributes, selfClosing) { |
| 3942 | this.anythingElse(); |
| 3943 | tree.insertionMode.processStartTag(name, attributes, selfClosing); |
| 3944 | }; |
| 3945 | |
| 3946 | modes.beforeHTML.processEndTag = function(name) { |
| 3947 | this.anythingElse(); |
| 3948 | tree.insertionMode.processEndTag(name); |
| 3949 | }; |
| 3950 | |
| 3951 | modes.beforeHTML.anythingElse = function() { |
| 3952 | tree.insertHtmlElement(); |
| 3953 | tree.setInsertionMode('beforeHead'); |
| 3954 | }; |
| 3955 | |
| 3956 | modes.afterAfterBody = Object.create(modes.base); |
| 3957 | |
| 3958 | modes.afterAfterBody.start_tag_handlers = { |
| 3959 | html: 'startTagHtml', |
| 3960 | '-default': 'startTagOther' |
| 3961 | }; |
| 3962 | |
| 3963 | modes.afterAfterBody.processComment = function(data) { |
| 3964 | tree.insertComment(data, tree.document); |
| 3965 | }; |
| 3966 | |
| 3967 | modes.afterAfterBody.processDoctype = function(data) { |
| 3968 | modes.inBody.processDoctype(data); |
| 3969 | }; |
| 3970 | |
| 3971 | modes.afterAfterBody.startTagHtml = function(data, attributes) { |
| 3972 | modes.inBody.startTagHtml(data, attributes); |
| 3973 | }; |
| 3974 | |
| 3975 | modes.afterAfterBody.startTagOther = function(name, attributes, selfClosing) { |
| 3976 | tree.parseError('unexpected-start-tag', {name: name}); |
| 3977 | tree.setInsertionMode('inBody'); |
| 3978 | tree.insertionMode.processStartTag(name, attributes, selfClosing); |
| 3979 | }; |
| 3980 | |
| 3981 | modes.afterAfterBody.endTagOther = function(name) { |
| 3982 | tree.parseError('unexpected-end-tag', {name: name}); |
| 3983 | tree.setInsertionMode('inBody'); |
| 3984 | tree.insertionMode.processEndTag(name); |
| 3985 | }; |
| 3986 | |
| 3987 | modes.afterAfterBody.processCharacters = function(data) { |
| 3988 | if (!isAllWhitespace(data.characters)) { |
| 3989 | tree.parseError('unexpected-char-after-body'); |
| 3990 | tree.setInsertionMode('inBody'); |
| 3991 | return tree.insertionMode.processCharacters(data); |
| 3992 | } |
| 3993 | modes.inBody.processCharacters(data); |
| 3994 | }; |
| 3995 | |
| 3996 | modes.afterBody = Object.create(modes.base); |
| 3997 | |
| 3998 | modes.afterBody.end_tag_handlers = { |
| 3999 | html: 'endTagHtml', |
| 4000 | '-default': 'endTagOther' |
| 4001 | }; |
| 4002 | |
| 4003 | modes.afterBody.processComment = function(data) { |
| 4004 | tree.insertComment(data, tree.openElements.rootNode); |
| 4005 | }; |
| 4006 | |
| 4007 | modes.afterBody.processCharacters = function(data) { |
| 4008 | if (!isAllWhitespace(data.characters)) { |
| 4009 | tree.parseError('unexpected-char-after-body'); |
| 4010 | tree.setInsertionMode('inBody'); |
| 4011 | return tree.insertionMode.processCharacters(data); |
| 4012 | } |
| 4013 | modes.inBody.processCharacters(data); |
| 4014 | }; |
| 4015 | |
| 4016 | modes.afterBody.processStartTag = function(name, attributes, selfClosing) { |
| 4017 | tree.parseError('unexpected-start-tag-after-body', {name: name}); |
| 4018 | tree.setInsertionMode('inBody'); |
| 4019 | tree.insertionMode.processStartTag(name, attributes, selfClosing); |
| 4020 | }; |
| 4021 | |
| 4022 | modes.afterBody.endTagHtml = function(name) { |
| 4023 | if (tree.context) { |
| 4024 | tree.parseError('end-html-in-innerhtml'); |
| 4025 | } else { |
| 4026 | tree.setInsertionMode('afterAfterBody'); |
| 4027 | } |
| 4028 | }; |
| 4029 | |
| 4030 | modes.afterBody.endTagOther = function(name) { |
| 4031 | tree.parseError('unexpected-end-tag-after-body', {name: name}); |
| 4032 | tree.setInsertionMode('inBody'); |
| 4033 | tree.insertionMode.processEndTag(name); |
| 4034 | }; |
| 4035 | |
| 4036 | modes.afterFrameset = Object.create(modes.base); |
| 4037 | |
| 4038 | modes.afterFrameset.start_tag_handlers = { |
| 4039 | html: 'startTagHtml', |
| 4040 | noframes: 'startTagNoframes', |
| 4041 | '-default': 'startTagOther' |
| 4042 | }; |
| 4043 | |
| 4044 | modes.afterFrameset.end_tag_handlers = { |
| 4045 | html: 'endTagHtml', |
| 4046 | '-default': 'endTagOther' |
| 4047 | }; |
| 4048 | |
| 4049 | modes.afterFrameset.processCharacters = function(buffer) { |
| 4050 | var characters = buffer.takeRemaining(); |
| 4051 | var whitespace = ""; |
| 4052 | for (var i = 0; i < characters.length; i++) { |
| 4053 | var ch = characters[i]; |
| 4054 | if (isWhitespace(ch)) |
| 4055 | whitespace += ch; |
| 4056 | } |
| 4057 | if (whitespace) { |
| 4058 | tree.insertText(whitespace); |
| 4059 | } |
| 4060 | if (whitespace.length < characters.length) |
| 4061 | tree.parseError('expected-eof-but-got-char'); |
| 4062 | }; |
| 4063 | |
| 4064 | modes.afterFrameset.startTagNoframes = function(name, attributes) { |
| 4065 | modes.inHead.processStartTag(name, attributes); |
| 4066 | }; |
| 4067 | |
| 4068 | modes.afterFrameset.startTagOther = function(name, attributes) { |
| 4069 | tree.parseError("unexpected-start-tag-after-frameset", {name: name}); |
| 4070 | }; |
| 4071 | |
| 4072 | modes.afterFrameset.endTagHtml = function(name) { |
| 4073 | tree.setInsertionMode('afterAfterFrameset'); |
| 4074 | }; |
| 4075 | |
| 4076 | modes.afterFrameset.endTagOther = function(name) { |
| 4077 | tree.parseError("unexpected-end-tag-after-frameset", {name: name}); |
| 4078 | }; |
| 4079 | |
| 4080 | modes.beforeHead = Object.create(modes.base); |
| 4081 | |
| 4082 | modes.beforeHead.start_tag_handlers = { |
| 4083 | html: 'startTagHtml', |
| 4084 | head: 'startTagHead', |
| 4085 | '-default': 'startTagOther' |
| 4086 | }; |
| 4087 | |
| 4088 | modes.beforeHead.end_tag_handlers = { |
| 4089 | html: 'endTagImplyHead', |
| 4090 | head: 'endTagImplyHead', |
| 4091 | body: 'endTagImplyHead', |
| 4092 | br: 'endTagImplyHead', |
| 4093 | '-default': 'endTagOther' |
| 4094 | }; |
| 4095 | |
| 4096 | modes.beforeHead.processEOF = function() { |
| 4097 | this.startTagHead('head', []); |
| 4098 | tree.insertionMode.processEOF(); |
| 4099 | }; |
| 4100 | |
| 4101 | modes.beforeHead.processCharacters = function(buffer) { |
| 4102 | buffer.skipLeadingWhitespace(); |
| 4103 | if (!buffer.length) |
| 4104 | return; |
| 4105 | this.startTagHead('head', []); |
| 4106 | tree.insertionMode.processCharacters(buffer); |
| 4107 | }; |
| 4108 | |
| 4109 | modes.beforeHead.startTagHead = function(name, attributes) { |
| 4110 | tree.insertHeadElement(attributes); |
| 4111 | tree.setInsertionMode('inHead'); |
| 4112 | }; |
| 4113 | |
| 4114 | modes.beforeHead.startTagOther = function(name, attributes, selfClosing) { |
| 4115 | this.startTagHead('head', []); |
| 4116 | tree.insertionMode.processStartTag(name, attributes, selfClosing); |
| 4117 | }; |
| 4118 | |
| 4119 | modes.beforeHead.endTagImplyHead = function(name) { |
| 4120 | this.startTagHead('head', []); |
| 4121 | tree.insertionMode.processEndTag(name); |
| 4122 | }; |
| 4123 | |
| 4124 | modes.beforeHead.endTagOther = function(name) { |
| 4125 | tree.parseError('end-tag-after-implied-root', {name: name}); |
| 4126 | }; |
| 4127 | |
| 4128 | modes.inHead = Object.create(modes.base); |
| 4129 | |
| 4130 | modes.inHead.start_tag_handlers = { |
| 4131 | html: 'startTagHtml', |
| 4132 | head: 'startTagHead', |
| 4133 | title: 'startTagTitle', |
| 4134 | script: 'startTagScript', |
| 4135 | style: 'startTagNoFramesStyle', |
| 4136 | noscript: 'startTagNoScript', |
| 4137 | noframes: 'startTagNoFramesStyle', |
| 4138 | base: 'startTagBaseBasefontBgsoundLink', |
| 4139 | basefont: 'startTagBaseBasefontBgsoundLink', |
| 4140 | bgsound: 'startTagBaseBasefontBgsoundLink', |
| 4141 | link: 'startTagBaseBasefontBgsoundLink', |
| 4142 | meta: 'startTagMeta', |
| 4143 | "-default": 'startTagOther' |
| 4144 | }; |
| 4145 | |
| 4146 | modes.inHead.end_tag_handlers = { |
| 4147 | head: 'endTagHead', |
| 4148 | html: 'endTagHtmlBodyBr', |
| 4149 | body: 'endTagHtmlBodyBr', |
| 4150 | br: 'endTagHtmlBodyBr', |
| 4151 | "-default": 'endTagOther' |
| 4152 | }; |
| 4153 | |
| 4154 | modes.inHead.processEOF = function() { |
| 4155 | var name = tree.currentStackItem().localName; |
| 4156 | if (['title', 'style', 'script'].indexOf(name) != -1) { |
| 4157 | tree.parseError("expected-named-closing-tag-but-got-eof", {name: name}); |
| 4158 | tree.popElement(); |
| 4159 | } |
| 4160 | |
| 4161 | this.anythingElse(); |
| 4162 | |
| 4163 | tree.insertionMode.processEOF(); |
| 4164 | }; |
| 4165 | |
| 4166 | modes.inHead.processCharacters = function(buffer) { |
| 4167 | var leadingWhitespace = buffer.takeLeadingWhitespace(); |
| 4168 | if (leadingWhitespace) |
| 4169 | tree.insertText(leadingWhitespace); |
| 4170 | if (!buffer.length) |
| 4171 | return; |
| 4172 | this.anythingElse(); |
| 4173 | tree.insertionMode.processCharacters(buffer); |
| 4174 | }; |
| 4175 | |
| 4176 | modes.inHead.startTagHtml = function(name, attributes) { |
| 4177 | modes.inBody.processStartTag(name, attributes); |
| 4178 | }; |
| 4179 | |
| 4180 | modes.inHead.startTagHead = function(name, attributes) { |
| 4181 | tree.parseError('two-heads-are-not-better-than-one'); |
| 4182 | }; |
| 4183 | |
| 4184 | modes.inHead.startTagTitle = function(name, attributes) { |
| 4185 | tree.processGenericRCDATAStartTag(name, attributes); |
| 4186 | }; |
| 4187 | |
| 4188 | modes.inHead.startTagNoScript = function(name, attributes) { |
| 4189 | if (tree.scriptingEnabled) |
| 4190 | return tree.processGenericRawTextStartTag(name, attributes); |
| 4191 | tree.insertElement(name, attributes); |
| 4192 | tree.setInsertionMode('inHeadNoscript'); |
| 4193 | }; |
| 4194 | |
| 4195 | modes.inHead.startTagNoFramesStyle = function(name, attributes) { |
| 4196 | tree.processGenericRawTextStartTag(name, attributes); |
| 4197 | }; |
| 4198 | |
| 4199 | modes.inHead.startTagScript = function(name, attributes) { |
| 4200 | tree.insertElement(name, attributes); |
| 4201 | tree.tokenizer.setState(Tokenizer.SCRIPT_DATA); |
| 4202 | tree.originalInsertionMode = tree.insertionModeName; |
| 4203 | tree.setInsertionMode('text'); |
| 4204 | }; |
| 4205 | |
| 4206 | modes.inHead.startTagBaseBasefontBgsoundLink = function(name, attributes) { |
| 4207 | tree.insertSelfClosingElement(name, attributes); |
| 4208 | }; |
| 4209 | |
| 4210 | modes.inHead.startTagMeta = function(name, attributes) { |
| 4211 | tree.insertSelfClosingElement(name, attributes); |
| 4212 | }; |
| 4213 | |
| 4214 | modes.inHead.startTagOther = function(name, attributes, selfClosing) { |
| 4215 | this.anythingElse(); |
| 4216 | tree.insertionMode.processStartTag(name, attributes, selfClosing); |
| 4217 | }; |
| 4218 | |
| 4219 | modes.inHead.endTagHead = function(name) { |
| 4220 | if (tree.openElements.item(tree.openElements.length - 1).localName == 'head') { |
| 4221 | tree.openElements.pop(); |
| 4222 | } else { |
| 4223 | tree.parseError('unexpected-end-tag', {name: 'head'}); |
| 4224 | } |
| 4225 | tree.setInsertionMode('afterHead'); |
| 4226 | }; |
| 4227 | |
| 4228 | modes.inHead.endTagHtmlBodyBr = function(name) { |
| 4229 | this.anythingElse(); |
| 4230 | tree.insertionMode.processEndTag(name); |
| 4231 | }; |
| 4232 | |
| 4233 | modes.inHead.endTagOther = function(name) { |
| 4234 | tree.parseError('unexpected-end-tag', {name: name}); |
| 4235 | }; |
| 4236 | |
| 4237 | modes.inHead.anythingElse = function() { |
| 4238 | this.endTagHead('head'); |
| 4239 | }; |
| 4240 | |
| 4241 | modes.afterHead = Object.create(modes.base); |
| 4242 | |
| 4243 | modes.afterHead.start_tag_handlers = { |
| 4244 | html: 'startTagHtml', |
| 4245 | head: 'startTagHead', |
| 4246 | body: 'startTagBody', |
| 4247 | frameset: 'startTagFrameset', |
| 4248 | base: 'startTagFromHead', |
| 4249 | link: 'startTagFromHead', |
| 4250 | meta: 'startTagFromHead', |
| 4251 | script: 'startTagFromHead', |
| 4252 | style: 'startTagFromHead', |
| 4253 | title: 'startTagFromHead', |
| 4254 | "-default": 'startTagOther' |
| 4255 | }; |
| 4256 | |
| 4257 | modes.afterHead.end_tag_handlers = { |
| 4258 | body: 'endTagBodyHtmlBr', |
| 4259 | html: 'endTagBodyHtmlBr', |
| 4260 | br: 'endTagBodyHtmlBr', |
| 4261 | "-default": 'endTagOther' |
| 4262 | }; |
| 4263 | |
| 4264 | modes.afterHead.processEOF = function() { |
| 4265 | this.anythingElse(); |
| 4266 | tree.insertionMode.processEOF(); |
| 4267 | }; |
| 4268 | |
| 4269 | modes.afterHead.processCharacters = function(buffer) { |
| 4270 | var leadingWhitespace = buffer.takeLeadingWhitespace(); |
| 4271 | if (leadingWhitespace) |
| 4272 | tree.insertText(leadingWhitespace); |
| 4273 | if (!buffer.length) |
| 4274 | return; |
| 4275 | this.anythingElse(); |
| 4276 | tree.insertionMode.processCharacters(buffer); |
| 4277 | }; |
| 4278 | |
| 4279 | modes.afterHead.startTagHtml = function(name, attributes) { |
| 4280 | modes.inBody.processStartTag(name, attributes); |
| 4281 | }; |
| 4282 | |
| 4283 | modes.afterHead.startTagBody = function(name, attributes) { |
| 4284 | tree.framesetOk = false; |
| 4285 | tree.insertBodyElement(attributes); |
| 4286 | tree.setInsertionMode('inBody'); |
| 4287 | }; |
| 4288 | |
| 4289 | modes.afterHead.startTagFrameset = function(name, attributes) { |
| 4290 | tree.insertElement(name, attributes); |
| 4291 | tree.setInsertionMode('inFrameset'); |
| 4292 | }; |
| 4293 | |
| 4294 | modes.afterHead.startTagFromHead = function(name, attributes, selfClosing) { |
| 4295 | tree.parseError("unexpected-start-tag-out-of-my-head", {name: name}); |
| 4296 | tree.openElements.push(tree.head); |
| 4297 | modes.inHead.processStartTag(name, attributes, selfClosing); |
| 4298 | tree.openElements.remove(tree.head); |
| 4299 | }; |
| 4300 | |
| 4301 | modes.afterHead.startTagHead = function(name, attributes, selfClosing) { |
| 4302 | tree.parseError('unexpected-start-tag', {name: name}); |
| 4303 | }; |
| 4304 | |
| 4305 | modes.afterHead.startTagOther = function(name, attributes, selfClosing) { |
| 4306 | this.anythingElse(); |
| 4307 | tree.insertionMode.processStartTag(name, attributes, selfClosing); |
| 4308 | }; |
| 4309 | |
| 4310 | modes.afterHead.endTagBodyHtmlBr = function(name) { |
| 4311 | this.anythingElse(); |
| 4312 | tree.insertionMode.processEndTag(name); |
| 4313 | }; |
| 4314 | |
| 4315 | modes.afterHead.endTagOther = function(name) { |
| 4316 | tree.parseError('unexpected-end-tag', {name: name}); |
| 4317 | }; |
| 4318 | |
| 4319 | modes.afterHead.anythingElse = function() { |
| 4320 | tree.insertBodyElement([]); |
| 4321 | tree.setInsertionMode('inBody'); |
| 4322 | tree.framesetOk = true; |
| 4323 | } |
| 4324 | |
| 4325 | modes.inBody = Object.create(modes.base); |
| 4326 | |
| 4327 | modes.inBody.start_tag_handlers = { |
| 4328 | html: 'startTagHtml', |
| 4329 | head: 'startTagMisplaced', |
| 4330 | base: 'startTagProcessInHead', |
| 4331 | basefont: 'startTagProcessInHead', |
| 4332 | bgsound: 'startTagProcessInHead', |
| 4333 | link: 'startTagProcessInHead', |
| 4334 | meta: 'startTagProcessInHead', |
| 4335 | noframes: 'startTagProcessInHead', |
| 4336 | script: 'startTagProcessInHead', |
| 4337 | style: 'startTagProcessInHead', |
| 4338 | title: 'startTagProcessInHead', |
| 4339 | body: 'startTagBody', |
| 4340 | form: 'startTagForm', |
| 4341 | plaintext: 'startTagPlaintext', |
| 4342 | a: 'startTagA', |
| 4343 | button: 'startTagButton', |
| 4344 | xmp: 'startTagXmp', |
| 4345 | table: 'startTagTable', |
| 4346 | hr: 'startTagHr', |
| 4347 | image: 'startTagImage', |
| 4348 | input: 'startTagInput', |
| 4349 | textarea: 'startTagTextarea', |
| 4350 | select: 'startTagSelect', |
| 4351 | isindex: 'startTagIsindex', |
| 4352 | applet: 'startTagAppletMarqueeObject', |
| 4353 | marquee: 'startTagAppletMarqueeObject', |
| 4354 | object: 'startTagAppletMarqueeObject', |
| 4355 | li: 'startTagListItem', |
| 4356 | dd: 'startTagListItem', |
| 4357 | dt: 'startTagListItem', |
| 4358 | address: 'startTagCloseP', |
| 4359 | article: 'startTagCloseP', |
| 4360 | aside: 'startTagCloseP', |
| 4361 | blockquote: 'startTagCloseP', |
| 4362 | center: 'startTagCloseP', |
| 4363 | details: 'startTagCloseP', |
| 4364 | dir: 'startTagCloseP', |
| 4365 | div: 'startTagCloseP', |
| 4366 | dl: 'startTagCloseP', |
| 4367 | fieldset: 'startTagCloseP', |
| 4368 | figcaption: 'startTagCloseP', |
| 4369 | figure: 'startTagCloseP', |
| 4370 | footer: 'startTagCloseP', |
| 4371 | header: 'startTagCloseP', |
| 4372 | hgroup: 'startTagCloseP', |
| 4373 | main: 'startTagCloseP', |
| 4374 | menu: 'startTagCloseP', |
| 4375 | nav: 'startTagCloseP', |
| 4376 | ol: 'startTagCloseP', |
| 4377 | p: 'startTagCloseP', |
| 4378 | section: 'startTagCloseP', |
| 4379 | summary: 'startTagCloseP', |
| 4380 | ul: 'startTagCloseP', |
| 4381 | listing: 'startTagPreListing', |
| 4382 | pre: 'startTagPreListing', |
| 4383 | b: 'startTagFormatting', |
| 4384 | big: 'startTagFormatting', |
| 4385 | code: 'startTagFormatting', |
| 4386 | em: 'startTagFormatting', |
| 4387 | font: 'startTagFormatting', |
| 4388 | i: 'startTagFormatting', |
| 4389 | s: 'startTagFormatting', |
| 4390 | small: 'startTagFormatting', |
| 4391 | strike: 'startTagFormatting', |
| 4392 | strong: 'startTagFormatting', |
| 4393 | tt: 'startTagFormatting', |
| 4394 | u: 'startTagFormatting', |
| 4395 | nobr: 'startTagNobr', |
| 4396 | area: 'startTagVoidFormatting', |
| 4397 | br: 'startTagVoidFormatting', |
| 4398 | embed: 'startTagVoidFormatting', |
| 4399 | img: 'startTagVoidFormatting', |
| 4400 | keygen: 'startTagVoidFormatting', |
| 4401 | wbr: 'startTagVoidFormatting', |
| 4402 | param: 'startTagParamSourceTrack', |
| 4403 | source: 'startTagParamSourceTrack', |
| 4404 | track: 'startTagParamSourceTrack', |
| 4405 | iframe: 'startTagIFrame', |
| 4406 | noembed: 'startTagRawText', |
| 4407 | noscript: 'startTagRawText', |
| 4408 | h1: 'startTagHeading', |
| 4409 | h2: 'startTagHeading', |
| 4410 | h3: 'startTagHeading', |
| 4411 | h4: 'startTagHeading', |
| 4412 | h5: 'startTagHeading', |
| 4413 | h6: 'startTagHeading', |
| 4414 | caption: 'startTagMisplaced', |
| 4415 | col: 'startTagMisplaced', |
| 4416 | colgroup: 'startTagMisplaced', |
| 4417 | frame: 'startTagMisplaced', |
| 4418 | frameset: 'startTagFrameset', |
| 4419 | tbody: 'startTagMisplaced', |
| 4420 | td: 'startTagMisplaced', |
| 4421 | tfoot: 'startTagMisplaced', |
| 4422 | th: 'startTagMisplaced', |
| 4423 | thead: 'startTagMisplaced', |
| 4424 | tr: 'startTagMisplaced', |
| 4425 | option: 'startTagOptionOptgroup', |
| 4426 | optgroup: 'startTagOptionOptgroup', |
| 4427 | math: 'startTagMath', |
| 4428 | svg: 'startTagSVG', |
| 4429 | rt: 'startTagRpRt', |
| 4430 | rp: 'startTagRpRt', |
| 4431 | "-default": 'startTagOther' |
| 4432 | }; |
| 4433 | |
| 4434 | modes.inBody.end_tag_handlers = { |
| 4435 | p: 'endTagP', |
| 4436 | body: 'endTagBody', |
| 4437 | html: 'endTagHtml', |
| 4438 | address: 'endTagBlock', |
| 4439 | article: 'endTagBlock', |
| 4440 | aside: 'endTagBlock', |
| 4441 | blockquote: 'endTagBlock', |
| 4442 | button: 'endTagBlock', |
| 4443 | center: 'endTagBlock', |
| 4444 | details: 'endTagBlock', |
| 4445 | dir: 'endTagBlock', |
| 4446 | div: 'endTagBlock', |
| 4447 | dl: 'endTagBlock', |
| 4448 | fieldset: 'endTagBlock', |
| 4449 | figcaption: 'endTagBlock', |
| 4450 | figure: 'endTagBlock', |
| 4451 | footer: 'endTagBlock', |
| 4452 | header: 'endTagBlock', |
| 4453 | hgroup: 'endTagBlock', |
| 4454 | listing: 'endTagBlock', |
| 4455 | main: 'endTagBlock', |
| 4456 | menu: 'endTagBlock', |
| 4457 | nav: 'endTagBlock', |
| 4458 | ol: 'endTagBlock', |
| 4459 | pre: 'endTagBlock', |
| 4460 | section: 'endTagBlock', |
| 4461 | summary: 'endTagBlock', |
| 4462 | ul: 'endTagBlock', |
| 4463 | form: 'endTagForm', |
| 4464 | applet: 'endTagAppletMarqueeObject', |
| 4465 | marquee: 'endTagAppletMarqueeObject', |
| 4466 | object: 'endTagAppletMarqueeObject', |
| 4467 | dd: 'endTagListItem', |
| 4468 | dt: 'endTagListItem', |
| 4469 | li: 'endTagListItem', |
| 4470 | h1: 'endTagHeading', |
| 4471 | h2: 'endTagHeading', |
| 4472 | h3: 'endTagHeading', |
| 4473 | h4: 'endTagHeading', |
| 4474 | h5: 'endTagHeading', |
| 4475 | h6: 'endTagHeading', |
| 4476 | a: 'endTagFormatting', |
| 4477 | b: 'endTagFormatting', |
| 4478 | big: 'endTagFormatting', |
| 4479 | code: 'endTagFormatting', |
| 4480 | em: 'endTagFormatting', |
| 4481 | font: 'endTagFormatting', |
| 4482 | i: 'endTagFormatting', |
| 4483 | nobr: 'endTagFormatting', |
| 4484 | s: 'endTagFormatting', |
| 4485 | small: 'endTagFormatting', |
| 4486 | strike: 'endTagFormatting', |
| 4487 | strong: 'endTagFormatting', |
| 4488 | tt: 'endTagFormatting', |
| 4489 | u: 'endTagFormatting', |
| 4490 | br: 'endTagBr', |
| 4491 | "-default": 'endTagOther' |
| 4492 | }; |
| 4493 | |
| 4494 | modes.inBody.processCharacters = function(buffer) { |
| 4495 | if (tree.shouldSkipLeadingNewline) { |
| 4496 | tree.shouldSkipLeadingNewline = false; |
| 4497 | buffer.skipAtMostOneLeadingNewline(); |
| 4498 | } |
| 4499 | tree.reconstructActiveFormattingElements(); |
| 4500 | var characters = buffer.takeRemaining(); |
| 4501 | characters = characters.replace(/\u0000/g, function(match, index){ |
| 4502 | tree.parseError("invalid-codepoint"); |
| 4503 | return ''; |
| 4504 | }); |
| 4505 | if (!characters) |
| 4506 | return; |
| 4507 | tree.insertText(characters); |
| 4508 | if (tree.framesetOk && !isAllWhitespaceOrReplacementCharacters(characters)) |
| 4509 | tree.framesetOk = false; |
| 4510 | }; |
| 4511 | |
| 4512 | modes.inBody.startTagHtml = function(name, attributes) { |
| 4513 | tree.parseError('non-html-root'); |
| 4514 | tree.addAttributesToElement(tree.openElements.rootNode, attributes); |
| 4515 | }; |
| 4516 | |
| 4517 | modes.inBody.startTagProcessInHead = function(name, attributes) { |
| 4518 | modes.inHead.processStartTag(name, attributes); |
| 4519 | }; |
| 4520 | |
| 4521 | modes.inBody.startTagBody = function(name, attributes) { |
| 4522 | tree.parseError('unexpected-start-tag', {name: 'body'}); |
| 4523 | if (tree.openElements.length == 1 || |
| 4524 | tree.openElements.item(1).localName != 'body') { |
| 4525 | assert.ok(tree.context); |
| 4526 | } else { |
| 4527 | tree.framesetOk = false; |
| 4528 | tree.addAttributesToElement(tree.openElements.bodyElement, attributes); |
| 4529 | } |
| 4530 | }; |
| 4531 | |
| 4532 | modes.inBody.startTagFrameset = function(name, attributes) { |
| 4533 | tree.parseError('unexpected-start-tag', {name: 'frameset'}); |
| 4534 | if (tree.openElements.length == 1 || |
| 4535 | tree.openElements.item(1).localName != 'body') { |
| 4536 | assert.ok(tree.context); |
| 4537 | } else if (tree.framesetOk) { |
| 4538 | tree.detachFromParent(tree.openElements.bodyElement); |
| 4539 | while (tree.openElements.length > 1) |
| 4540 | tree.openElements.pop(); |
| 4541 | tree.insertElement(name, attributes); |
| 4542 | tree.setInsertionMode('inFrameset'); |
| 4543 | } |
| 4544 | }; |
| 4545 | |
| 4546 | modes.inBody.startTagCloseP = function(name, attributes) { |
| 4547 | if (tree.openElements.inButtonScope('p')) |
| 4548 | this.endTagP('p'); |
| 4549 | tree.insertElement(name, attributes); |
| 4550 | }; |
| 4551 | |
| 4552 | modes.inBody.startTagPreListing = function(name, attributes) { |
| 4553 | if (tree.openElements.inButtonScope('p')) |
| 4554 | this.endTagP('p'); |
| 4555 | tree.insertElement(name, attributes); |
| 4556 | tree.framesetOk = false; |
| 4557 | tree.shouldSkipLeadingNewline = true; |
| 4558 | }; |
| 4559 | |
| 4560 | modes.inBody.startTagForm = function(name, attributes) { |
| 4561 | if (tree.form) { |
| 4562 | tree.parseError('unexpected-start-tag', {name: name}); |
| 4563 | } else { |
| 4564 | if (tree.openElements.inButtonScope('p')) |
| 4565 | this.endTagP('p'); |
| 4566 | tree.insertElement(name, attributes); |
| 4567 | tree.form = tree.currentStackItem(); |
| 4568 | } |
| 4569 | }; |
| 4570 | |
| 4571 | modes.inBody.startTagRpRt = function(name, attributes) { |
| 4572 | if (tree.openElements.inScope('ruby')) { |
| 4573 | tree.generateImpliedEndTags(); |
| 4574 | if (tree.currentStackItem().localName != 'ruby') { |
| 4575 | tree.parseError('unexpected-start-tag', {name: name}); |
| 4576 | } |
| 4577 | } |
| 4578 | tree.insertElement(name, attributes); |
| 4579 | }; |
| 4580 | |
| 4581 | modes.inBody.startTagListItem = function(name, attributes) { |
| 4582 | var stopNames = {li: ['li'], dd: ['dd', 'dt'], dt: ['dd', 'dt']}; |
| 4583 | var stopName = stopNames[name]; |
| 4584 | |
| 4585 | var els = tree.openElements; |
| 4586 | for (var i = els.length - 1; i >= 0; i--) { |
| 4587 | var node = els.item(i); |
| 4588 | if (stopName.indexOf(node.localName) != -1) { |
| 4589 | tree.insertionMode.processEndTag(node.localName); |
| 4590 | break; |
| 4591 | } |
| 4592 | if (node.isSpecial() && node.localName !== 'p' && node.localName !== 'address' && node.localName !== 'div') |
| 4593 | break; |
| 4594 | } |
| 4595 | if (tree.openElements.inButtonScope('p')) |
| 4596 | this.endTagP('p'); |
| 4597 | tree.insertElement(name, attributes); |
| 4598 | tree.framesetOk = false; |
| 4599 | }; |
| 4600 | |
| 4601 | modes.inBody.startTagPlaintext = function(name, attributes) { |
| 4602 | if (tree.openElements.inButtonScope('p')) |
| 4603 | this.endTagP('p'); |
| 4604 | tree.insertElement(name, attributes); |
| 4605 | tree.tokenizer.setState(Tokenizer.PLAINTEXT); |
| 4606 | }; |
| 4607 | |
| 4608 | modes.inBody.startTagHeading = function(name, attributes) { |
| 4609 | if (tree.openElements.inButtonScope('p')) |
| 4610 | this.endTagP('p'); |
| 4611 | if (tree.currentStackItem().isNumberedHeader()) { |
| 4612 | tree.parseError('unexpected-start-tag', {name: name}); |
| 4613 | tree.popElement(); |
| 4614 | } |
| 4615 | tree.insertElement(name, attributes); |
| 4616 | }; |
| 4617 | |
| 4618 | modes.inBody.startTagA = function(name, attributes) { |
| 4619 | var activeA = tree.elementInActiveFormattingElements('a'); |
| 4620 | if (activeA) { |
| 4621 | tree.parseError("unexpected-start-tag-implies-end-tag", {startName: "a", endName: "a"}); |
| 4622 | tree.adoptionAgencyEndTag('a'); |
| 4623 | if (tree.openElements.contains(activeA)) |
| 4624 | tree.openElements.remove(activeA); |
| 4625 | tree.removeElementFromActiveFormattingElements(activeA); |
| 4626 | } |
| 4627 | tree.reconstructActiveFormattingElements(); |
| 4628 | tree.insertFormattingElement(name, attributes); |
| 4629 | }; |
| 4630 | |
| 4631 | modes.inBody.startTagFormatting = function(name, attributes) { |
| 4632 | tree.reconstructActiveFormattingElements(); |
| 4633 | tree.insertFormattingElement(name, attributes); |
| 4634 | }; |
| 4635 | |
| 4636 | modes.inBody.startTagNobr = function(name, attributes) { |
| 4637 | tree.reconstructActiveFormattingElements(); |
| 4638 | if (tree.openElements.inScope('nobr')) { |
| 4639 | tree.parseError("unexpected-start-tag-implies-end-tag", {startName: 'nobr', endName: 'nobr'}); |
| 4640 | this.processEndTag('nobr'); |
| 4641 | tree.reconstructActiveFormattingElements(); |
| 4642 | } |
| 4643 | tree.insertFormattingElement(name, attributes); |
| 4644 | }; |
| 4645 | |
| 4646 | modes.inBody.startTagButton = function(name, attributes) { |
| 4647 | if (tree.openElements.inScope('button')) { |
| 4648 | tree.parseError('unexpected-start-tag-implies-end-tag', {startName: 'button', endName: 'button'}); |
| 4649 | this.processEndTag('button'); |
| 4650 | tree.insertionMode.processStartTag(name, attributes); |
| 4651 | } else { |
| 4652 | tree.framesetOk = false; |
| 4653 | tree.reconstructActiveFormattingElements(); |
| 4654 | tree.insertElement(name, attributes); |
| 4655 | } |
| 4656 | }; |
| 4657 | |
| 4658 | modes.inBody.startTagAppletMarqueeObject = function(name, attributes) { |
| 4659 | tree.reconstructActiveFormattingElements(); |
| 4660 | tree.insertElement(name, attributes); |
| 4661 | tree.activeFormattingElements.push(Marker); |
| 4662 | tree.framesetOk = false; |
| 4663 | }; |
| 4664 | |
| 4665 | modes.inBody.endTagAppletMarqueeObject = function(name) { |
| 4666 | if (!tree.openElements.inScope(name)) { |
| 4667 | tree.parseError("unexpected-end-tag", {name: name}); |
| 4668 | } else { |
| 4669 | tree.generateImpliedEndTags(); |
| 4670 | if (tree.currentStackItem().localName != name) { |
| 4671 | tree.parseError('end-tag-too-early', {name: name}); |
| 4672 | } |
| 4673 | tree.openElements.popUntilPopped(name); |
| 4674 | tree.clearActiveFormattingElements(); |
| 4675 | } |
| 4676 | }; |
| 4677 | |
| 4678 | modes.inBody.startTagXmp = function(name, attributes) { |
| 4679 | if (tree.openElements.inButtonScope('p')) |
| 4680 | this.processEndTag('p'); |
| 4681 | tree.reconstructActiveFormattingElements(); |
| 4682 | tree.processGenericRawTextStartTag(name, attributes); |
| 4683 | tree.framesetOk = false; |
| 4684 | }; |
| 4685 | |
| 4686 | modes.inBody.startTagTable = function(name, attributes) { |
| 4687 | if (tree.compatMode !== "quirks") |
| 4688 | if (tree.openElements.inButtonScope('p')) |
| 4689 | this.processEndTag('p'); |
| 4690 | tree.insertElement(name, attributes); |
| 4691 | tree.setInsertionMode('inTable'); |
| 4692 | tree.framesetOk = false; |
| 4693 | }; |
| 4694 | |
| 4695 | modes.inBody.startTagVoidFormatting = function(name, attributes) { |
| 4696 | tree.reconstructActiveFormattingElements(); |
| 4697 | tree.insertSelfClosingElement(name, attributes); |
| 4698 | tree.framesetOk = false; |
| 4699 | }; |
| 4700 | |
| 4701 | modes.inBody.startTagParamSourceTrack = function(name, attributes) { |
| 4702 | tree.insertSelfClosingElement(name, attributes); |
| 4703 | }; |
| 4704 | |
| 4705 | modes.inBody.startTagHr = function(name, attributes) { |
| 4706 | if (tree.openElements.inButtonScope('p')) |
| 4707 | this.endTagP('p'); |
| 4708 | tree.insertSelfClosingElement(name, attributes); |
| 4709 | tree.framesetOk = false; |
| 4710 | }; |
| 4711 | |
| 4712 | modes.inBody.startTagImage = function(name, attributes) { |
| 4713 | tree.parseError('unexpected-start-tag-treated-as', {originalName: 'image', newName: 'img'}); |
| 4714 | this.processStartTag('img', attributes); |
| 4715 | }; |
| 4716 | |
| 4717 | modes.inBody.startTagInput = function(name, attributes) { |
| 4718 | var currentFramesetOk = tree.framesetOk; |
| 4719 | this.startTagVoidFormatting(name, attributes); |
| 4720 | for (var key in attributes) { |
| 4721 | if (attributes[key].nodeName == 'type') { |
| 4722 | if (attributes[key].nodeValue.toLowerCase() == 'hidden') |
| 4723 | tree.framesetOk = currentFramesetOk; |
| 4724 | break; |
| 4725 | } |
| 4726 | } |
| 4727 | }; |
| 4728 | |
| 4729 | modes.inBody.startTagIsindex = function(name, attributes) { |
| 4730 | tree.parseError('deprecated-tag', {name: 'isindex'}); |
| 4731 | tree.selfClosingFlagAcknowledged = true; |
| 4732 | if (tree.form) |
| 4733 | return; |
| 4734 | var formAttributes = []; |
| 4735 | var inputAttributes = []; |
| 4736 | var prompt = "This is a searchable index. Enter search keywords: "; |
| 4737 | for (var key in attributes) { |
| 4738 | switch (attributes[key].nodeName) { |
| 4739 | case 'action': |
| 4740 | formAttributes.push({nodeName: 'action', |
| 4741 | nodeValue: attributes[key].nodeValue}); |
| 4742 | break; |
| 4743 | case 'prompt': |
| 4744 | prompt = attributes[key].nodeValue; |
| 4745 | break; |
| 4746 | case 'name': |
| 4747 | break; |
| 4748 | default: |
| 4749 | inputAttributes.push({nodeName: attributes[key].nodeName, |
| 4750 | nodeValue: attributes[key].nodeValue}); |
| 4751 | } |
| 4752 | } |
| 4753 | inputAttributes.push({nodeName: 'name', nodeValue: 'isindex'}); |
| 4754 | this.processStartTag('form', formAttributes); |
| 4755 | this.processStartTag('hr'); |
| 4756 | this.processStartTag('label'); |
| 4757 | this.processCharacters(new CharacterBuffer(prompt)); |
| 4758 | this.processStartTag('input', inputAttributes); |
| 4759 | this.processEndTag('label'); |
| 4760 | this.processStartTag('hr'); |
| 4761 | this.processEndTag('form'); |
| 4762 | }; |
| 4763 | |
| 4764 | modes.inBody.startTagTextarea = function(name, attributes) { |
| 4765 | tree.insertElement(name, attributes); |
| 4766 | tree.tokenizer.setState(Tokenizer.RCDATA); |
| 4767 | tree.originalInsertionMode = tree.insertionModeName; |
| 4768 | tree.shouldSkipLeadingNewline = true; |
| 4769 | tree.framesetOk = false; |
| 4770 | tree.setInsertionMode('text'); |
| 4771 | }; |
| 4772 | |
| 4773 | modes.inBody.startTagIFrame = function(name, attributes) { |
| 4774 | tree.framesetOk = false; |
| 4775 | this.startTagRawText(name, attributes); |
| 4776 | }; |
| 4777 | |
| 4778 | modes.inBody.startTagRawText = function(name, attributes) { |
| 4779 | tree.processGenericRawTextStartTag(name, attributes); |
| 4780 | }; |
| 4781 | |
| 4782 | modes.inBody.startTagSelect = function(name, attributes) { |
| 4783 | tree.reconstructActiveFormattingElements(); |
| 4784 | tree.insertElement(name, attributes); |
| 4785 | tree.framesetOk = false; |
| 4786 | var insertionModeName = tree.insertionModeName; |
| 4787 | if (insertionModeName == 'inTable' || |
| 4788 | insertionModeName == 'inCaption' || |
| 4789 | insertionModeName == 'inColumnGroup' || |
| 4790 | insertionModeName == 'inTableBody' || |
| 4791 | insertionModeName == 'inRow' || |
| 4792 | insertionModeName == 'inCell') { |
| 4793 | tree.setInsertionMode('inSelectInTable'); |
| 4794 | } else { |
| 4795 | tree.setInsertionMode('inSelect'); |
| 4796 | } |
| 4797 | }; |
| 4798 | |
| 4799 | modes.inBody.startTagMisplaced = function(name, attributes) { |
| 4800 | tree.parseError('unexpected-start-tag-ignored', {name: name}); |
| 4801 | }; |
| 4802 | |
| 4803 | modes.inBody.endTagMisplaced = function(name) { |
| 4804 | tree.parseError("unexpected-end-tag", {name: name}); |
| 4805 | }; |
| 4806 | |
| 4807 | modes.inBody.endTagBr = function(name) { |
| 4808 | tree.parseError("unexpected-end-tag-treated-as", {originalName: "br", newName: "br element"}); |
| 4809 | tree.reconstructActiveFormattingElements(); |
| 4810 | tree.insertElement(name, []); |
| 4811 | tree.popElement(); |
| 4812 | }; |
| 4813 | |
| 4814 | modes.inBody.startTagOptionOptgroup = function(name, attributes) { |
| 4815 | if (tree.currentStackItem().localName == 'option') |
| 4816 | tree.popElement(); |
| 4817 | tree.reconstructActiveFormattingElements(); |
| 4818 | tree.insertElement(name, attributes); |
| 4819 | }; |
| 4820 | |
| 4821 | modes.inBody.startTagOther = function(name, attributes) { |
| 4822 | tree.reconstructActiveFormattingElements(); |
| 4823 | tree.insertElement(name, attributes); |
| 4824 | }; |
| 4825 | |
| 4826 | modes.inBody.endTagOther = function(name) { |
| 4827 | var node; |
| 4828 | for (var i = tree.openElements.length - 1; i > 0; i--) { |
| 4829 | node = tree.openElements.item(i); |
| 4830 | if (node.localName == name) { |
| 4831 | tree.generateImpliedEndTags(name); |
| 4832 | if (tree.currentStackItem().localName != name) |
| 4833 | tree.parseError('unexpected-end-tag', {name: name}); |
| 4834 | tree.openElements.remove_openElements_until(function(x) {return x === node;}); |
| 4835 | break; |
| 4836 | } |
| 4837 | if (node.isSpecial()) { |
| 4838 | tree.parseError('unexpected-end-tag', {name: name}); |
| 4839 | break; |
| 4840 | } |
| 4841 | } |
| 4842 | }; |
| 4843 | |
| 4844 | modes.inBody.startTagMath = function(name, attributes, selfClosing) { |
| 4845 | tree.reconstructActiveFormattingElements(); |
| 4846 | attributes = tree.adjustMathMLAttributes(attributes); |
| 4847 | attributes = tree.adjustForeignAttributes(attributes); |
| 4848 | tree.insertForeignElement(name, attributes, "http://www.w3.org/1998/Math/MathML", selfClosing); |
| 4849 | }; |
| 4850 | |
| 4851 | modes.inBody.startTagSVG = function(name, attributes, selfClosing) { |
| 4852 | tree.reconstructActiveFormattingElements(); |
| 4853 | attributes = tree.adjustSVGAttributes(attributes); |
| 4854 | attributes = tree.adjustForeignAttributes(attributes); |
| 4855 | tree.insertForeignElement(name, attributes, "http://www.w3.org/2000/svg", selfClosing); |
| 4856 | }; |
| 4857 | |
| 4858 | modes.inBody.endTagP = function(name) { |
| 4859 | if (!tree.openElements.inButtonScope('p')) { |
| 4860 | tree.parseError('unexpected-end-tag', {name: 'p'}); |
| 4861 | this.startTagCloseP('p', []); |
| 4862 | this.endTagP('p'); |
| 4863 | } else { |
| 4864 | tree.generateImpliedEndTags('p'); |
| 4865 | if (tree.currentStackItem().localName != 'p') |
| 4866 | tree.parseError('unexpected-implied-end-tag', {name: 'p'}); |
| 4867 | tree.openElements.popUntilPopped(name); |
| 4868 | } |
| 4869 | }; |
| 4870 | |
| 4871 | modes.inBody.endTagBody = function(name) { |
| 4872 | if (!tree.openElements.inScope('body')) { |
| 4873 | tree.parseError('unexpected-end-tag', {name: name}); |
| 4874 | return; |
| 4875 | } |
| 4876 | if (tree.currentStackItem().localName != 'body') { |
| 4877 | tree.parseError('expected-one-end-tag-but-got-another', { |
| 4878 | expectedName: tree.currentStackItem().localName, |
| 4879 | gotName: name |
| 4880 | }); |
| 4881 | } |
| 4882 | tree.setInsertionMode('afterBody'); |
| 4883 | }; |
| 4884 | |
| 4885 | modes.inBody.endTagHtml = function(name) { |
| 4886 | if (!tree.openElements.inScope('body')) { |
| 4887 | tree.parseError('unexpected-end-tag', {name: name}); |
| 4888 | return; |
| 4889 | } |
| 4890 | if (tree.currentStackItem().localName != 'body') { |
| 4891 | tree.parseError('expected-one-end-tag-but-got-another', { |
| 4892 | expectedName: tree.currentStackItem().localName, |
| 4893 | gotName: name |
| 4894 | }); |
| 4895 | } |
| 4896 | tree.setInsertionMode('afterBody'); |
| 4897 | tree.insertionMode.processEndTag(name); |
| 4898 | }; |
| 4899 | |
| 4900 | modes.inBody.endTagBlock = function(name) { |
| 4901 | if (!tree.openElements.inScope(name)) { |
| 4902 | tree.parseError('unexpected-end-tag', {name: name}); |
| 4903 | } else { |
| 4904 | tree.generateImpliedEndTags(); |
| 4905 | if (tree.currentStackItem().localName != name) { |
| 4906 | tree.parseError('end-tag-too-early', {name: name}); |
| 4907 | } |
| 4908 | tree.openElements.popUntilPopped(name); |
| 4909 | } |
| 4910 | }; |
| 4911 | |
| 4912 | modes.inBody.endTagForm = function(name) { |
| 4913 | var node = tree.form; |
| 4914 | tree.form = null; |
| 4915 | if (!node || !tree.openElements.inScope(name)) { |
| 4916 | tree.parseError('unexpected-end-tag', {name: name}); |
| 4917 | } else { |
| 4918 | tree.generateImpliedEndTags(); |
| 4919 | if (tree.currentStackItem() != node) { |
| 4920 | tree.parseError('end-tag-too-early-ignored', {name: 'form'}); |
| 4921 | } |
| 4922 | tree.openElements.remove(node); |
| 4923 | } |
| 4924 | }; |
| 4925 | |
| 4926 | modes.inBody.endTagListItem = function(name) { |
| 4927 | if (!tree.openElements.inListItemScope(name)) { |
| 4928 | tree.parseError('unexpected-end-tag', {name: name}); |
| 4929 | } else { |
| 4930 | tree.generateImpliedEndTags(name); |
| 4931 | if (tree.currentStackItem().localName != name) |
| 4932 | tree.parseError('end-tag-too-early', {name: name}); |
| 4933 | tree.openElements.popUntilPopped(name); |
| 4934 | } |
| 4935 | }; |
| 4936 | |
| 4937 | modes.inBody.endTagHeading = function(name) { |
| 4938 | if (!tree.openElements.hasNumberedHeaderElementInScope()) { |
| 4939 | tree.parseError('unexpected-end-tag', {name: name}); |
| 4940 | return; |
| 4941 | } |
| 4942 | tree.generateImpliedEndTags(); |
| 4943 | if (tree.currentStackItem().localName != name) |
| 4944 | tree.parseError('end-tag-too-early', {name: name}); |
| 4945 | |
| 4946 | tree.openElements.remove_openElements_until(function(e) { |
| 4947 | return e.isNumberedHeader(); |
| 4948 | }); |
| 4949 | }; |
| 4950 | |
| 4951 | modes.inBody.endTagFormatting = function(name, attributes) { |
| 4952 | if (!tree.adoptionAgencyEndTag(name)) |
| 4953 | this.endTagOther(name, attributes); |
| 4954 | }; |
| 4955 | |
| 4956 | modes.inCaption = Object.create(modes.base); |
| 4957 | |
| 4958 | modes.inCaption.start_tag_handlers = { |
| 4959 | html: 'startTagHtml', |
| 4960 | caption: 'startTagTableElement', |
| 4961 | col: 'startTagTableElement', |
| 4962 | colgroup: 'startTagTableElement', |
| 4963 | tbody: 'startTagTableElement', |
| 4964 | td: 'startTagTableElement', |
| 4965 | tfoot: 'startTagTableElement', |
| 4966 | thead: 'startTagTableElement', |
| 4967 | tr: 'startTagTableElement', |
| 4968 | '-default': 'startTagOther' |
| 4969 | }; |
| 4970 | |
| 4971 | modes.inCaption.end_tag_handlers = { |
| 4972 | caption: 'endTagCaption', |
| 4973 | table: 'endTagTable', |
| 4974 | body: 'endTagIgnore', |
| 4975 | col: 'endTagIgnore', |
| 4976 | colgroup: 'endTagIgnore', |
| 4977 | html: 'endTagIgnore', |
| 4978 | tbody: 'endTagIgnore', |
| 4979 | td: 'endTagIgnore', |
| 4980 | tfood: 'endTagIgnore', |
| 4981 | thead: 'endTagIgnore', |
| 4982 | tr: 'endTagIgnore', |
| 4983 | '-default': 'endTagOther' |
| 4984 | }; |
| 4985 | |
| 4986 | modes.inCaption.processCharacters = function(data) { |
| 4987 | modes.inBody.processCharacters(data); |
| 4988 | }; |
| 4989 | |
| 4990 | modes.inCaption.startTagTableElement = function(name, attributes) { |
| 4991 | tree.parseError('unexpected-end-tag', {name: name}); |
| 4992 | var ignoreEndTag = !tree.openElements.inTableScope('caption'); |
| 4993 | tree.insertionMode.processEndTag('caption'); |
| 4994 | if (!ignoreEndTag) tree.insertionMode.processStartTag(name, attributes); |
| 4995 | }; |
| 4996 | |
| 4997 | modes.inCaption.startTagOther = function(name, attributes, selfClosing) { |
| 4998 | modes.inBody.processStartTag(name, attributes, selfClosing); |
| 4999 | }; |
| 5000 | |
| 5001 | modes.inCaption.endTagCaption = function(name) { |
| 5002 | if (!tree.openElements.inTableScope('caption')) { |
| 5003 | assert.ok(tree.context); |
| 5004 | tree.parseError('unexpected-end-tag', {name: name}); |
| 5005 | } else { |
| 5006 | tree.generateImpliedEndTags(); |
| 5007 | if (tree.currentStackItem().localName != 'caption') { |
| 5008 | tree.parseError('expected-one-end-tag-but-got-another', { |
| 5009 | gotName: "caption", |
| 5010 | expectedName: tree.currentStackItem().localName |
| 5011 | }); |
| 5012 | } |
| 5013 | tree.openElements.popUntilPopped('caption'); |
| 5014 | tree.clearActiveFormattingElements(); |
| 5015 | tree.setInsertionMode('inTable'); |
| 5016 | } |
| 5017 | }; |
| 5018 | |
| 5019 | modes.inCaption.endTagTable = function(name) { |
| 5020 | tree.parseError("unexpected-end-table-in-caption"); |
| 5021 | var ignoreEndTag = !tree.openElements.inTableScope('caption'); |
| 5022 | tree.insertionMode.processEndTag('caption'); |
| 5023 | if (!ignoreEndTag) tree.insertionMode.processEndTag(name); |
| 5024 | }; |
| 5025 | |
| 5026 | modes.inCaption.endTagIgnore = function(name) { |
| 5027 | tree.parseError('unexpected-end-tag', {name: name}); |
| 5028 | }; |
| 5029 | |
| 5030 | modes.inCaption.endTagOther = function(name) { |
| 5031 | modes.inBody.processEndTag(name); |
| 5032 | }; |
| 5033 | |
| 5034 | modes.inCell = Object.create(modes.base); |
| 5035 | |
| 5036 | modes.inCell.start_tag_handlers = { |
| 5037 | html: 'startTagHtml', |
| 5038 | caption: 'startTagTableOther', |
| 5039 | col: 'startTagTableOther', |
| 5040 | colgroup: 'startTagTableOther', |
| 5041 | tbody: 'startTagTableOther', |
| 5042 | td: 'startTagTableOther', |
| 5043 | tfoot: 'startTagTableOther', |
| 5044 | th: 'startTagTableOther', |
| 5045 | thead: 'startTagTableOther', |
| 5046 | tr: 'startTagTableOther', |
| 5047 | '-default': 'startTagOther' |
| 5048 | }; |
| 5049 | |
| 5050 | modes.inCell.end_tag_handlers = { |
| 5051 | td: 'endTagTableCell', |
| 5052 | th: 'endTagTableCell', |
| 5053 | body: 'endTagIgnore', |
| 5054 | caption: 'endTagIgnore', |
| 5055 | col: 'endTagIgnore', |
| 5056 | colgroup: 'endTagIgnore', |
| 5057 | html: 'endTagIgnore', |
| 5058 | table: 'endTagImply', |
| 5059 | tbody: 'endTagImply', |
| 5060 | tfoot: 'endTagImply', |
| 5061 | thead: 'endTagImply', |
| 5062 | tr: 'endTagImply', |
| 5063 | '-default': 'endTagOther' |
| 5064 | }; |
| 5065 | |
| 5066 | modes.inCell.processCharacters = function(data) { |
| 5067 | modes.inBody.processCharacters(data); |
| 5068 | }; |
| 5069 | |
| 5070 | modes.inCell.startTagTableOther = function(name, attributes, selfClosing) { |
| 5071 | if (tree.openElements.inTableScope('td') || tree.openElements.inTableScope('th')) { |
| 5072 | this.closeCell(); |
| 5073 | tree.insertionMode.processStartTag(name, attributes, selfClosing); |
| 5074 | } else { |
| 5075 | tree.parseError('unexpected-start-tag', {name: name}); |
| 5076 | } |
| 5077 | }; |
| 5078 | |
| 5079 | modes.inCell.startTagOther = function(name, attributes, selfClosing) { |
| 5080 | modes.inBody.processStartTag(name, attributes, selfClosing); |
| 5081 | }; |
| 5082 | |
| 5083 | modes.inCell.endTagTableCell = function(name) { |
| 5084 | if (tree.openElements.inTableScope(name)) { |
| 5085 | tree.generateImpliedEndTags(name); |
| 5086 | if (tree.currentStackItem().localName != name.toLowerCase()) { |
| 5087 | tree.parseError('unexpected-cell-end-tag', {name: name}); |
| 5088 | tree.openElements.popUntilPopped(name); |
| 5089 | } else { |
| 5090 | tree.popElement(); |
| 5091 | } |
| 5092 | tree.clearActiveFormattingElements(); |
| 5093 | tree.setInsertionMode('inRow'); |
| 5094 | } else { |
| 5095 | tree.parseError('unexpected-end-tag', {name: name}); |
| 5096 | } |
| 5097 | }; |
| 5098 | |
| 5099 | modes.inCell.endTagIgnore = function(name) { |
| 5100 | tree.parseError('unexpected-end-tag', {name: name}); |
| 5101 | }; |
| 5102 | |
| 5103 | modes.inCell.endTagImply = function(name) { |
| 5104 | if (tree.openElements.inTableScope(name)) { |
| 5105 | this.closeCell(); |
| 5106 | tree.insertionMode.processEndTag(name); |
| 5107 | } else { |
| 5108 | tree.parseError('unexpected-end-tag', {name: name}); |
| 5109 | } |
| 5110 | }; |
| 5111 | |
| 5112 | modes.inCell.endTagOther = function(name) { |
| 5113 | modes.inBody.processEndTag(name); |
| 5114 | }; |
| 5115 | |
| 5116 | modes.inCell.closeCell = function() { |
| 5117 | if (tree.openElements.inTableScope('td')) { |
| 5118 | this.endTagTableCell('td'); |
| 5119 | } else if (tree.openElements.inTableScope('th')) { |
| 5120 | this.endTagTableCell('th'); |
| 5121 | } |
| 5122 | }; |
| 5123 | |
| 5124 | |
| 5125 | modes.inColumnGroup = Object.create(modes.base); |
| 5126 | |
| 5127 | modes.inColumnGroup.start_tag_handlers = { |
| 5128 | html: 'startTagHtml', |
| 5129 | col: 'startTagCol', |
| 5130 | '-default': 'startTagOther' |
| 5131 | }; |
| 5132 | |
| 5133 | modes.inColumnGroup.end_tag_handlers = { |
| 5134 | colgroup: 'endTagColgroup', |
| 5135 | col: 'endTagCol', |
| 5136 | '-default': 'endTagOther' |
| 5137 | }; |
| 5138 | |
| 5139 | modes.inColumnGroup.ignoreEndTagColgroup = function() { |
| 5140 | return tree.currentStackItem().localName == 'html'; |
| 5141 | }; |
| 5142 | |
| 5143 | modes.inColumnGroup.processCharacters = function(buffer) { |
| 5144 | var leadingWhitespace = buffer.takeLeadingWhitespace(); |
| 5145 | if (leadingWhitespace) |
| 5146 | tree.insertText(leadingWhitespace); |
| 5147 | if (!buffer.length) |
| 5148 | return; |
| 5149 | var ignoreEndTag = this.ignoreEndTagColgroup(); |
| 5150 | this.endTagColgroup('colgroup'); |
| 5151 | if (!ignoreEndTag) tree.insertionMode.processCharacters(buffer); |
| 5152 | }; |
| 5153 | |
| 5154 | modes.inColumnGroup.startTagCol = function(name, attributes) { |
| 5155 | tree.insertSelfClosingElement(name, attributes); |
| 5156 | }; |
| 5157 | |
| 5158 | modes.inColumnGroup.startTagOther = function(name, attributes, selfClosing) { |
| 5159 | var ignoreEndTag = this.ignoreEndTagColgroup(); |
| 5160 | this.endTagColgroup('colgroup'); |
| 5161 | if (!ignoreEndTag) tree.insertionMode.processStartTag(name, attributes, selfClosing); |
| 5162 | }; |
| 5163 | |
| 5164 | modes.inColumnGroup.endTagColgroup = function(name) { |
| 5165 | if (this.ignoreEndTagColgroup()) { |
| 5166 | assert.ok(tree.context); |
| 5167 | tree.parseError('unexpected-end-tag', {name: name}); |
| 5168 | } else { |
| 5169 | tree.popElement(); |
| 5170 | tree.setInsertionMode('inTable'); |
| 5171 | } |
| 5172 | }; |
| 5173 | |
| 5174 | modes.inColumnGroup.endTagCol = function(name) { |
| 5175 | tree.parseError("no-end-tag", {name: 'col'}); |
| 5176 | }; |
| 5177 | |
| 5178 | modes.inColumnGroup.endTagOther = function(name) { |
| 5179 | var ignoreEndTag = this.ignoreEndTagColgroup(); |
| 5180 | this.endTagColgroup('colgroup'); |
| 5181 | if (!ignoreEndTag) tree.insertionMode.processEndTag(name) ; |
| 5182 | }; |
| 5183 | |
| 5184 | modes.inForeignContent = Object.create(modes.base); |
| 5185 | |
| 5186 | modes.inForeignContent.processStartTag = function(name, attributes, selfClosing) { |
| 5187 | if (['b', 'big', 'blockquote', 'body', 'br', 'center', 'code', 'dd', 'div', 'dl', 'dt', 'em', 'embed', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'hr', 'i', 'img', 'li', 'listing', 'menu', 'meta', 'nobr', 'ol', 'p', 'pre', 'ruby', 's', 'small', 'span', 'strong', 'strike', 'sub', 'sup', 'table', 'tt', 'u', 'ul', 'var'].indexOf(name) != -1 |
| 5188 | || (name == 'font' && attributes.some(function(attr){ return ['color', 'face', 'size'].indexOf(attr.nodeName) >= 0 }))) { |
| 5189 | tree.parseError('unexpected-html-element-in-foreign-content', {name: name}); |
| 5190 | while (tree.currentStackItem().isForeign() |
| 5191 | && !tree.currentStackItem().isHtmlIntegrationPoint() |
| 5192 | && !tree.currentStackItem().isMathMLTextIntegrationPoint()) { |
| 5193 | tree.openElements.pop(); |
| 5194 | } |
| 5195 | tree.insertionMode.processStartTag(name, attributes, selfClosing); |
| 5196 | return; |
| 5197 | } |
| 5198 | if (tree.currentStackItem().namespaceURI == "http://www.w3.org/1998/Math/MathML") { |
| 5199 | attributes = tree.adjustMathMLAttributes(attributes); |
| 5200 | } |
| 5201 | if (tree.currentStackItem().namespaceURI == "http://www.w3.org/2000/svg") { |
| 5202 | name = tree.adjustSVGTagNameCase(name); |
| 5203 | attributes = tree.adjustSVGAttributes(attributes); |
| 5204 | } |
| 5205 | attributes = tree.adjustForeignAttributes(attributes); |
| 5206 | tree.insertForeignElement(name, attributes, tree.currentStackItem().namespaceURI, selfClosing); |
| 5207 | }; |
| 5208 | |
| 5209 | modes.inForeignContent.processEndTag = function(name) { |
| 5210 | var node = tree.currentStackItem(); |
| 5211 | var index = tree.openElements.length - 1; |
| 5212 | if (node.localName.toLowerCase() != name) |
| 5213 | tree.parseError("unexpected-end-tag", {name: name}); |
| 5214 | |
| 5215 | while (true) { |
| 5216 | if (index === 0) |
| 5217 | break; |
| 5218 | if (node.localName.toLowerCase() == name) { |
| 5219 | while (tree.openElements.pop() != node); |
| 5220 | break; |
| 5221 | } |
| 5222 | index -= 1; |
| 5223 | node = tree.openElements.item(index); |
| 5224 | if (node.isForeign()) { |
| 5225 | continue; |
| 5226 | } else { |
| 5227 | tree.insertionMode.processEndTag(name); |
| 5228 | break; |
| 5229 | } |
| 5230 | } |
| 5231 | }; |
| 5232 | |
| 5233 | modes.inForeignContent.processCharacters = function(buffer) { |
| 5234 | var characters = buffer.takeRemaining(); |
| 5235 | characters = characters.replace(/\u0000/g, function(match, index){ |
| 5236 | tree.parseError('invalid-codepoint'); |
| 5237 | return '\uFFFD'; |
| 5238 | }); |
| 5239 | if (tree.framesetOk && !isAllWhitespaceOrReplacementCharacters(characters)) |
| 5240 | tree.framesetOk = false; |
| 5241 | tree.insertText(characters); |
| 5242 | }; |
| 5243 | |
| 5244 | modes.inHeadNoscript = Object.create(modes.base); |
| 5245 | |
| 5246 | modes.inHeadNoscript.start_tag_handlers = { |
| 5247 | html: 'startTagHtml', |
| 5248 | basefont: 'startTagBasefontBgsoundLinkMetaNoframesStyle', |
| 5249 | bgsound: 'startTagBasefontBgsoundLinkMetaNoframesStyle', |
| 5250 | link: 'startTagBasefontBgsoundLinkMetaNoframesStyle', |
| 5251 | meta: 'startTagBasefontBgsoundLinkMetaNoframesStyle', |
| 5252 | noframes: 'startTagBasefontBgsoundLinkMetaNoframesStyle', |
| 5253 | style: 'startTagBasefontBgsoundLinkMetaNoframesStyle', |
| 5254 | head: 'startTagHeadNoscript', |
| 5255 | noscript: 'startTagHeadNoscript', |
| 5256 | "-default": 'startTagOther' |
| 5257 | }; |
| 5258 | |
| 5259 | modes.inHeadNoscript.end_tag_handlers = { |
| 5260 | noscript: 'endTagNoscript', |
| 5261 | br: 'endTagBr', |
| 5262 | '-default': 'endTagOther' |
| 5263 | }; |
| 5264 | |
| 5265 | modes.inHeadNoscript.processCharacters = function(buffer) { |
| 5266 | var leadingWhitespace = buffer.takeLeadingWhitespace(); |
| 5267 | if (leadingWhitespace) |
| 5268 | tree.insertText(leadingWhitespace); |
| 5269 | if (!buffer.length) |
| 5270 | return; |
| 5271 | tree.parseError("unexpected-char-in-frameset"); |
| 5272 | this.anythingElse(); |
| 5273 | tree.insertionMode.processCharacters(buffer); |
| 5274 | }; |
| 5275 | |
| 5276 | modes.inHeadNoscript.processComment = function(data) { |
| 5277 | modes.inHead.processComment(data); |
| 5278 | }; |
| 5279 | |
| 5280 | modes.inHeadNoscript.startTagBasefontBgsoundLinkMetaNoframesStyle = function(name, attributes) { |
| 5281 | modes.inHead.processStartTag(name, attributes); |
| 5282 | }; |
| 5283 | |
| 5284 | modes.inHeadNoscript.startTagHeadNoscript = function(name, attributes) { |
| 5285 | tree.parseError("unexpected-start-tag-in-frameset", {name: name}); |
| 5286 | }; |
| 5287 | |
| 5288 | modes.inHeadNoscript.startTagOther = function(name, attributes) { |
| 5289 | tree.parseError("unexpected-start-tag-in-frameset", {name: name}); |
| 5290 | this.anythingElse(); |
| 5291 | tree.insertionMode.processStartTag(name, attributes); |
| 5292 | }; |
| 5293 | |
| 5294 | modes.inHeadNoscript.endTagBr = function(name, attributes) { |
| 5295 | tree.parseError("unexpected-end-tag-in-frameset", {name: name}); |
| 5296 | this.anythingElse(); |
| 5297 | tree.insertionMode.processEndTag(name, attributes); |
| 5298 | }; |
| 5299 | |
| 5300 | modes.inHeadNoscript.endTagNoscript = function(name, attributes) { |
| 5301 | tree.popElement(); |
| 5302 | tree.setInsertionMode('inHead'); |
| 5303 | }; |
| 5304 | |
| 5305 | modes.inHeadNoscript.endTagOther = function(name, attributes) { |
| 5306 | tree.parseError("unexpected-end-tag-in-frameset", {name: name}); |
| 5307 | }; |
| 5308 | |
| 5309 | modes.inHeadNoscript.anythingElse = function() { |
| 5310 | tree.popElement(); |
| 5311 | tree.setInsertionMode('inHead'); |
| 5312 | }; |
| 5313 | |
| 5314 | |
| 5315 | modes.inFrameset = Object.create(modes.base); |
| 5316 | |
| 5317 | modes.inFrameset.start_tag_handlers = { |
| 5318 | html: 'startTagHtml', |
| 5319 | frameset: 'startTagFrameset', |
| 5320 | frame: 'startTagFrame', |
| 5321 | noframes: 'startTagNoframes', |
| 5322 | "-default": 'startTagOther' |
| 5323 | }; |
| 5324 | |
| 5325 | modes.inFrameset.end_tag_handlers = { |
| 5326 | frameset: 'endTagFrameset', |
| 5327 | noframes: 'endTagNoframes', |
| 5328 | '-default': 'endTagOther' |
| 5329 | }; |
| 5330 | |
| 5331 | modes.inFrameset.processCharacters = function(data) { |
| 5332 | tree.parseError("unexpected-char-in-frameset"); |
| 5333 | }; |
| 5334 | |
| 5335 | modes.inFrameset.startTagFrameset = function(name, attributes) { |
| 5336 | tree.insertElement(name, attributes); |
| 5337 | }; |
| 5338 | |
| 5339 | modes.inFrameset.startTagFrame = function(name, attributes) { |
| 5340 | tree.insertSelfClosingElement(name, attributes); |
| 5341 | }; |
| 5342 | |
| 5343 | modes.inFrameset.startTagNoframes = function(name, attributes) { |
| 5344 | modes.inBody.processStartTag(name, attributes); |
| 5345 | }; |
| 5346 | |
| 5347 | modes.inFrameset.startTagOther = function(name, attributes) { |
| 5348 | tree.parseError("unexpected-start-tag-in-frameset", {name: name}); |
| 5349 | }; |
| 5350 | |
| 5351 | modes.inFrameset.endTagFrameset = function(name, attributes) { |
| 5352 | if (tree.currentStackItem().localName == 'html') { |
| 5353 | tree.parseError("unexpected-frameset-in-frameset-innerhtml"); |
| 5354 | } else { |
| 5355 | tree.popElement(); |
| 5356 | } |
| 5357 | |
| 5358 | if (!tree.context && tree.currentStackItem().localName != 'frameset') { |
| 5359 | tree.setInsertionMode('afterFrameset'); |
| 5360 | } |
| 5361 | }; |
| 5362 | |
| 5363 | modes.inFrameset.endTagNoframes = function(name) { |
| 5364 | modes.inBody.processEndTag(name); |
| 5365 | }; |
| 5366 | |
| 5367 | modes.inFrameset.endTagOther = function(name) { |
| 5368 | tree.parseError("unexpected-end-tag-in-frameset", {name: name}); |
| 5369 | }; |
| 5370 | |
| 5371 | modes.inTable = Object.create(modes.base); |
| 5372 | |
| 5373 | modes.inTable.start_tag_handlers = { |
| 5374 | html: 'startTagHtml', |
| 5375 | caption: 'startTagCaption', |
| 5376 | colgroup: 'startTagColgroup', |
| 5377 | col: 'startTagCol', |
| 5378 | table: 'startTagTable', |
| 5379 | tbody: 'startTagRowGroup', |
| 5380 | tfoot: 'startTagRowGroup', |
| 5381 | thead: 'startTagRowGroup', |
| 5382 | td: 'startTagImplyTbody', |
| 5383 | th: 'startTagImplyTbody', |
| 5384 | tr: 'startTagImplyTbody', |
| 5385 | style: 'startTagStyleScript', |
| 5386 | script: 'startTagStyleScript', |
| 5387 | input: 'startTagInput', |
| 5388 | form: 'startTagForm', |
| 5389 | '-default': 'startTagOther' |
| 5390 | }; |
| 5391 | |
| 5392 | modes.inTable.end_tag_handlers = { |
| 5393 | table: 'endTagTable', |
| 5394 | body: 'endTagIgnore', |
| 5395 | caption: 'endTagIgnore', |
| 5396 | col: 'endTagIgnore', |
| 5397 | colgroup: 'endTagIgnore', |
| 5398 | html: 'endTagIgnore', |
| 5399 | tbody: 'endTagIgnore', |
| 5400 | td: 'endTagIgnore', |
| 5401 | tfoot: 'endTagIgnore', |
| 5402 | th: 'endTagIgnore', |
| 5403 | thead: 'endTagIgnore', |
| 5404 | tr: 'endTagIgnore', |
| 5405 | '-default': 'endTagOther' |
| 5406 | }; |
| 5407 | |
| 5408 | modes.inTable.processCharacters = function(data) { |
| 5409 | if (tree.currentStackItem().isFosterParenting()) { |
| 5410 | var originalInsertionMode = tree.insertionModeName; |
| 5411 | tree.setInsertionMode('inTableText'); |
| 5412 | tree.originalInsertionMode = originalInsertionMode; |
| 5413 | tree.insertionMode.processCharacters(data); |
| 5414 | } else { |
| 5415 | tree.redirectAttachToFosterParent = true; |
| 5416 | modes.inBody.processCharacters(data); |
| 5417 | tree.redirectAttachToFosterParent = false; |
| 5418 | } |
| 5419 | }; |
| 5420 | |
| 5421 | modes.inTable.startTagCaption = function(name, attributes) { |
| 5422 | tree.openElements.popUntilTableScopeMarker(); |
| 5423 | tree.activeFormattingElements.push(Marker); |
| 5424 | tree.insertElement(name, attributes); |
| 5425 | tree.setInsertionMode('inCaption'); |
| 5426 | }; |
| 5427 | |
| 5428 | modes.inTable.startTagColgroup = function(name, attributes) { |
| 5429 | tree.openElements.popUntilTableScopeMarker(); |
| 5430 | tree.insertElement(name, attributes); |
| 5431 | tree.setInsertionMode('inColumnGroup'); |
| 5432 | }; |
| 5433 | |
| 5434 | modes.inTable.startTagCol = function(name, attributes) { |
| 5435 | this.startTagColgroup('colgroup', []); |
| 5436 | tree.insertionMode.processStartTag(name, attributes); |
| 5437 | }; |
| 5438 | |
| 5439 | modes.inTable.startTagRowGroup = function(name, attributes) { |
| 5440 | tree.openElements.popUntilTableScopeMarker(); |
| 5441 | tree.insertElement(name, attributes); |
| 5442 | tree.setInsertionMode('inTableBody'); |
| 5443 | }; |
| 5444 | |
| 5445 | modes.inTable.startTagImplyTbody = function(name, attributes) { |
| 5446 | this.startTagRowGroup('tbody', []); |
| 5447 | tree.insertionMode.processStartTag(name, attributes); |
| 5448 | }; |
| 5449 | |
| 5450 | modes.inTable.startTagTable = function(name, attributes) { |
| 5451 | tree.parseError("unexpected-start-tag-implies-end-tag", |
| 5452 | {startName: "table", endName: "table"}); |
| 5453 | tree.insertionMode.processEndTag('table'); |
| 5454 | if (!tree.context) tree.insertionMode.processStartTag(name, attributes); |
| 5455 | }; |
| 5456 | |
| 5457 | modes.inTable.startTagStyleScript = function(name, attributes) { |
| 5458 | modes.inHead.processStartTag(name, attributes); |
| 5459 | }; |
| 5460 | |
| 5461 | modes.inTable.startTagInput = function(name, attributes) { |
| 5462 | for (var key in attributes) { |
| 5463 | if (attributes[key].nodeName.toLowerCase() == 'type') { |
| 5464 | if (attributes[key].nodeValue.toLowerCase() == 'hidden') { |
| 5465 | tree.parseError("unexpected-hidden-input-in-table"); |
| 5466 | tree.insertElement(name, attributes); |
| 5467 | tree.openElements.pop(); |
| 5468 | return; |
| 5469 | } |
| 5470 | break; |
| 5471 | } |
| 5472 | } |
| 5473 | this.startTagOther(name, attributes); |
| 5474 | }; |
| 5475 | |
| 5476 | modes.inTable.startTagForm = function(name, attributes) { |
| 5477 | tree.parseError("unexpected-form-in-table"); |
| 5478 | if (!tree.form) { |
| 5479 | tree.insertElement(name, attributes); |
| 5480 | tree.form = tree.currentStackItem(); |
| 5481 | tree.openElements.pop(); |
| 5482 | } |
| 5483 | }; |
| 5484 | |
| 5485 | modes.inTable.startTagOther = function(name, attributes, selfClosing) { |
| 5486 | tree.parseError("unexpected-start-tag-implies-table-voodoo", {name: name}); |
| 5487 | tree.redirectAttachToFosterParent = true; |
| 5488 | modes.inBody.processStartTag(name, attributes, selfClosing); |
| 5489 | tree.redirectAttachToFosterParent = false; |
| 5490 | }; |
| 5491 | |
| 5492 | modes.inTable.endTagTable = function(name) { |
| 5493 | if (tree.openElements.inTableScope(name)) { |
| 5494 | tree.generateImpliedEndTags(); |
| 5495 | if (tree.currentStackItem().localName != name) { |
| 5496 | tree.parseError("end-tag-too-early-named", {gotName: 'table', expectedName: tree.currentStackItem().localName}); |
| 5497 | } |
| 5498 | |
| 5499 | tree.openElements.popUntilPopped('table'); |
| 5500 | tree.resetInsertionMode(); |
| 5501 | } else { |
| 5502 | assert.ok(tree.context); |
| 5503 | tree.parseError('unexpected-end-tag', {name: name}); |
| 5504 | } |
| 5505 | }; |
| 5506 | |
| 5507 | modes.inTable.endTagIgnore = function(name) { |
| 5508 | tree.parseError("unexpected-end-tag", {name: name}); |
| 5509 | }; |
| 5510 | |
| 5511 | modes.inTable.endTagOther = function(name) { |
| 5512 | tree.parseError("unexpected-end-tag-implies-table-voodoo", {name: name}); |
| 5513 | tree.redirectAttachToFosterParent = true; |
| 5514 | modes.inBody.processEndTag(name); |
| 5515 | tree.redirectAttachToFosterParent = false; |
| 5516 | }; |
| 5517 | |
| 5518 | modes.inTableText = Object.create(modes.base); |
| 5519 | |
| 5520 | modes.inTableText.flushCharacters = function() { |
| 5521 | var characters = tree.pendingTableCharacters.join(''); |
| 5522 | if (!isAllWhitespace(characters)) { |
| 5523 | tree.redirectAttachToFosterParent = true; |
| 5524 | tree.reconstructActiveFormattingElements(); |
| 5525 | tree.insertText(characters); |
| 5526 | tree.framesetOk = false; |
| 5527 | tree.redirectAttachToFosterParent = false; |
| 5528 | } else { |
| 5529 | tree.insertText(characters); |
| 5530 | } |
| 5531 | tree.pendingTableCharacters = []; |
| 5532 | }; |
| 5533 | |
| 5534 | modes.inTableText.processComment = function(data) { |
| 5535 | this.flushCharacters(); |
| 5536 | tree.setInsertionMode(tree.originalInsertionMode); |
| 5537 | tree.insertionMode.processComment(data); |
| 5538 | }; |
| 5539 | |
| 5540 | modes.inTableText.processEOF = function(data) { |
| 5541 | this.flushCharacters(); |
| 5542 | tree.setInsertionMode(tree.originalInsertionMode); |
| 5543 | tree.insertionMode.processEOF(); |
| 5544 | }; |
| 5545 | |
| 5546 | modes.inTableText.processCharacters = function(buffer) { |
| 5547 | var characters = buffer.takeRemaining(); |
| 5548 | characters = characters.replace(/\u0000/g, function(match, index){ |
| 5549 | tree.parseError("invalid-codepoint"); |
| 5550 | return ''; |
| 5551 | }); |
| 5552 | if (!characters) |
| 5553 | return; |
| 5554 | tree.pendingTableCharacters.push(characters); |
| 5555 | }; |
| 5556 | |
| 5557 | modes.inTableText.processStartTag = function(name, attributes, selfClosing) { |
| 5558 | this.flushCharacters(); |
| 5559 | tree.setInsertionMode(tree.originalInsertionMode); |
| 5560 | tree.insertionMode.processStartTag(name, attributes, selfClosing); |
| 5561 | }; |
| 5562 | |
| 5563 | modes.inTableText.processEndTag = function(name, attributes) { |
| 5564 | this.flushCharacters(); |
| 5565 | tree.setInsertionMode(tree.originalInsertionMode); |
| 5566 | tree.insertionMode.processEndTag(name, attributes); |
| 5567 | }; |
| 5568 | |
| 5569 | modes.inTableBody = Object.create(modes.base); |
| 5570 | |
| 5571 | modes.inTableBody.start_tag_handlers = { |
| 5572 | html: 'startTagHtml', |
| 5573 | tr: 'startTagTr', |
| 5574 | td: 'startTagTableCell', |
| 5575 | th: 'startTagTableCell', |
| 5576 | caption: 'startTagTableOther', |
| 5577 | col: 'startTagTableOther', |
| 5578 | colgroup: 'startTagTableOther', |
| 5579 | tbody: 'startTagTableOther', |
| 5580 | tfoot: 'startTagTableOther', |
| 5581 | thead: 'startTagTableOther', |
| 5582 | '-default': 'startTagOther' |
| 5583 | }; |
| 5584 | |
| 5585 | modes.inTableBody.end_tag_handlers = { |
| 5586 | table: 'endTagTable', |
| 5587 | tbody: 'endTagTableRowGroup', |
| 5588 | tfoot: 'endTagTableRowGroup', |
| 5589 | thead: 'endTagTableRowGroup', |
| 5590 | body: 'endTagIgnore', |
| 5591 | caption: 'endTagIgnore', |
| 5592 | col: 'endTagIgnore', |
| 5593 | colgroup: 'endTagIgnore', |
| 5594 | html: 'endTagIgnore', |
| 5595 | td: 'endTagIgnore', |
| 5596 | th: 'endTagIgnore', |
| 5597 | tr: 'endTagIgnore', |
| 5598 | '-default': 'endTagOther' |
| 5599 | }; |
| 5600 | |
| 5601 | modes.inTableBody.processCharacters = function(data) { |
| 5602 | modes.inTable.processCharacters(data); |
| 5603 | }; |
| 5604 | |
| 5605 | modes.inTableBody.startTagTr = function(name, attributes) { |
| 5606 | tree.openElements.popUntilTableBodyScopeMarker(); |
| 5607 | tree.insertElement(name, attributes); |
| 5608 | tree.setInsertionMode('inRow'); |
| 5609 | }; |
| 5610 | |
| 5611 | modes.inTableBody.startTagTableCell = function(name, attributes) { |
| 5612 | tree.parseError("unexpected-cell-in-table-body", {name: name}); |
| 5613 | this.startTagTr('tr', []); |
| 5614 | tree.insertionMode.processStartTag(name, attributes); |
| 5615 | }; |
| 5616 | |
| 5617 | modes.inTableBody.startTagTableOther = function(name, attributes) { |
| 5618 | if (tree.openElements.inTableScope('tbody') || tree.openElements.inTableScope('thead') || tree.openElements.inTableScope('tfoot')) { |
| 5619 | tree.openElements.popUntilTableBodyScopeMarker(); |
| 5620 | this.endTagTableRowGroup(tree.currentStackItem().localName); |
| 5621 | tree.insertionMode.processStartTag(name, attributes); |
| 5622 | } else { |
| 5623 | tree.parseError('unexpected-start-tag', {name: name}); |
| 5624 | } |
| 5625 | }; |
| 5626 | |
| 5627 | modes.inTableBody.startTagOther = function(name, attributes) { |
| 5628 | modes.inTable.processStartTag(name, attributes); |
| 5629 | }; |
| 5630 | |
| 5631 | modes.inTableBody.endTagTableRowGroup = function(name) { |
| 5632 | if (tree.openElements.inTableScope(name)) { |
| 5633 | tree.openElements.popUntilTableBodyScopeMarker(); |
| 5634 | tree.popElement(); |
| 5635 | tree.setInsertionMode('inTable'); |
| 5636 | } else { |
| 5637 | tree.parseError('unexpected-end-tag-in-table-body', {name: name}); |
| 5638 | } |
| 5639 | }; |
| 5640 | |
| 5641 | modes.inTableBody.endTagTable = function(name) { |
| 5642 | if (tree.openElements.inTableScope('tbody') || tree.openElements.inTableScope('thead') || tree.openElements.inTableScope('tfoot')) { |
| 5643 | tree.openElements.popUntilTableBodyScopeMarker(); |
| 5644 | this.endTagTableRowGroup(tree.currentStackItem().localName); |
| 5645 | tree.insertionMode.processEndTag(name); |
| 5646 | } else { |
| 5647 | tree.parseError('unexpected-end-tag', {name: name}); |
| 5648 | } |
| 5649 | }; |
| 5650 | |
| 5651 | modes.inTableBody.endTagIgnore = function(name) { |
| 5652 | tree.parseError("unexpected-end-tag-in-table-body", {name: name}); |
| 5653 | }; |
| 5654 | |
| 5655 | modes.inTableBody.endTagOther = function(name) { |
| 5656 | modes.inTable.processEndTag(name); |
| 5657 | }; |
| 5658 | |
| 5659 | modes.inSelect = Object.create(modes.base); |
| 5660 | |
| 5661 | modes.inSelect.start_tag_handlers = { |
| 5662 | html: 'startTagHtml', |
| 5663 | option: 'startTagOption', |
| 5664 | optgroup: 'startTagOptgroup', |
| 5665 | select: 'startTagSelect', |
| 5666 | input: 'startTagInput', |
| 5667 | keygen: 'startTagInput', |
| 5668 | textarea: 'startTagInput', |
| 5669 | script: 'startTagScript', |
| 5670 | '-default': 'startTagOther' |
| 5671 | }; |
| 5672 | |
| 5673 | modes.inSelect.end_tag_handlers = { |
| 5674 | option: 'endTagOption', |
| 5675 | optgroup: 'endTagOptgroup', |
| 5676 | select: 'endTagSelect', |
| 5677 | caption: 'endTagTableElements', |
| 5678 | table: 'endTagTableElements', |
| 5679 | tbody: 'endTagTableElements', |
| 5680 | tfoot: 'endTagTableElements', |
| 5681 | thead: 'endTagTableElements', |
| 5682 | tr: 'endTagTableElements', |
| 5683 | td: 'endTagTableElements', |
| 5684 | th: 'endTagTableElements', |
| 5685 | '-default': 'endTagOther' |
| 5686 | }; |
| 5687 | |
| 5688 | modes.inSelect.processCharacters = function(buffer) { |
| 5689 | var data = buffer.takeRemaining(); |
| 5690 | data = data.replace(/\u0000/g, function(match, index){ |
| 5691 | tree.parseError("invalid-codepoint"); |
| 5692 | return ''; |
| 5693 | }); |
| 5694 | if (!data) |
| 5695 | return; |
| 5696 | tree.insertText(data); |
| 5697 | }; |
| 5698 | |
| 5699 | modes.inSelect.startTagOption = function(name, attributes) { |
| 5700 | if (tree.currentStackItem().localName == 'option') |
| 5701 | tree.popElement(); |
| 5702 | tree.insertElement(name, attributes); |
| 5703 | }; |
| 5704 | |
| 5705 | modes.inSelect.startTagOptgroup = function(name, attributes) { |
| 5706 | if (tree.currentStackItem().localName == 'option') |
| 5707 | tree.popElement(); |
| 5708 | if (tree.currentStackItem().localName == 'optgroup') |
| 5709 | tree.popElement(); |
| 5710 | tree.insertElement(name, attributes); |
| 5711 | }; |
| 5712 | |
| 5713 | modes.inSelect.endTagOption = function(name) { |
| 5714 | if (tree.currentStackItem().localName !== 'option') { |
| 5715 | tree.parseError('unexpected-end-tag-in-select', {name: name}); |
| 5716 | return; |
| 5717 | } |
| 5718 | tree.popElement(); |
| 5719 | }; |
| 5720 | |
| 5721 | modes.inSelect.endTagOptgroup = function(name) { |
| 5722 | if (tree.currentStackItem().localName == 'option' && tree.openElements.item(tree.openElements.length - 2).localName == 'optgroup') { |
| 5723 | tree.popElement(); |
| 5724 | } |
| 5725 | if (tree.currentStackItem().localName == 'optgroup') { |
| 5726 | tree.popElement(); |
| 5727 | } else { |
| 5728 | tree.parseError('unexpected-end-tag-in-select', {name: 'optgroup'}); |
| 5729 | } |
| 5730 | }; |
| 5731 | |
| 5732 | modes.inSelect.startTagSelect = function(name) { |
| 5733 | tree.parseError("unexpected-select-in-select"); |
| 5734 | this.endTagSelect('select'); |
| 5735 | }; |
| 5736 | |
| 5737 | modes.inSelect.endTagSelect = function(name) { |
| 5738 | if (tree.openElements.inTableScope('select')) { |
| 5739 | tree.openElements.popUntilPopped('select'); |
| 5740 | tree.resetInsertionMode(); |
| 5741 | } else { |
| 5742 | tree.parseError('unexpected-end-tag', {name: name}); |
| 5743 | } |
| 5744 | }; |
| 5745 | |
| 5746 | modes.inSelect.startTagInput = function(name, attributes) { |
| 5747 | tree.parseError("unexpected-input-in-select"); |
| 5748 | if (tree.openElements.inSelectScope('select')) { |
| 5749 | this.endTagSelect('select'); |
| 5750 | tree.insertionMode.processStartTag(name, attributes); |
| 5751 | } |
| 5752 | }; |
| 5753 | |
| 5754 | modes.inSelect.startTagScript = function(name, attributes) { |
| 5755 | modes.inHead.processStartTag(name, attributes); |
| 5756 | }; |
| 5757 | |
| 5758 | modes.inSelect.endTagTableElements = function(name) { |
| 5759 | tree.parseError('unexpected-end-tag-in-select', {name: name}); |
| 5760 | if (tree.openElements.inTableScope(name)) { |
| 5761 | this.endTagSelect('select'); |
| 5762 | tree.insertionMode.processEndTag(name); |
| 5763 | } |
| 5764 | }; |
| 5765 | |
| 5766 | modes.inSelect.startTagOther = function(name, attributes) { |
| 5767 | tree.parseError("unexpected-start-tag-in-select", {name: name}); |
| 5768 | }; |
| 5769 | |
| 5770 | modes.inSelect.endTagOther = function(name) { |
| 5771 | tree.parseError('unexpected-end-tag-in-select', {name: name}); |
| 5772 | }; |
| 5773 | |
| 5774 | modes.inSelectInTable = Object.create(modes.base); |
| 5775 | |
| 5776 | modes.inSelectInTable.start_tag_handlers = { |
| 5777 | caption: 'startTagTable', |
| 5778 | table: 'startTagTable', |
| 5779 | tbody: 'startTagTable', |
| 5780 | tfoot: 'startTagTable', |
| 5781 | thead: 'startTagTable', |
| 5782 | tr: 'startTagTable', |
| 5783 | td: 'startTagTable', |
| 5784 | th: 'startTagTable', |
| 5785 | '-default': 'startTagOther' |
| 5786 | }; |
| 5787 | |
| 5788 | modes.inSelectInTable.end_tag_handlers = { |
| 5789 | caption: 'endTagTable', |
| 5790 | table: 'endTagTable', |
| 5791 | tbody: 'endTagTable', |
| 5792 | tfoot: 'endTagTable', |
| 5793 | thead: 'endTagTable', |
| 5794 | tr: 'endTagTable', |
| 5795 | td: 'endTagTable', |
| 5796 | th: 'endTagTable', |
| 5797 | '-default': 'endTagOther' |
| 5798 | }; |
| 5799 | |
| 5800 | modes.inSelectInTable.processCharacters = function(data) { |
| 5801 | modes.inSelect.processCharacters(data); |
| 5802 | }; |
| 5803 | |
| 5804 | modes.inSelectInTable.startTagTable = function(name, attributes) { |
| 5805 | tree.parseError("unexpected-table-element-start-tag-in-select-in-table", {name: name}); |
| 5806 | this.endTagOther("select"); |
| 5807 | tree.insertionMode.processStartTag(name, attributes); |
| 5808 | }; |
| 5809 | |
| 5810 | modes.inSelectInTable.startTagOther = function(name, attributes, selfClosing) { |
| 5811 | modes.inSelect.processStartTag(name, attributes, selfClosing); |
| 5812 | }; |
| 5813 | |
| 5814 | modes.inSelectInTable.endTagTable = function(name) { |
| 5815 | tree.parseError("unexpected-table-element-end-tag-in-select-in-table", {name: name}); |
| 5816 | if (tree.openElements.inTableScope(name)) { |
| 5817 | this.endTagOther("select"); |
| 5818 | tree.insertionMode.processEndTag(name); |
| 5819 | } |
| 5820 | }; |
| 5821 | |
| 5822 | modes.inSelectInTable.endTagOther = function(name) { |
| 5823 | modes.inSelect.processEndTag(name); |
| 5824 | }; |
| 5825 | |
| 5826 | modes.inRow = Object.create(modes.base); |
| 5827 | |
| 5828 | modes.inRow.start_tag_handlers = { |
| 5829 | html: 'startTagHtml', |
| 5830 | td: 'startTagTableCell', |
| 5831 | th: 'startTagTableCell', |
| 5832 | caption: 'startTagTableOther', |
| 5833 | col: 'startTagTableOther', |
| 5834 | colgroup: 'startTagTableOther', |
| 5835 | tbody: 'startTagTableOther', |
| 5836 | tfoot: 'startTagTableOther', |
| 5837 | thead: 'startTagTableOther', |
| 5838 | tr: 'startTagTableOther', |
| 5839 | '-default': 'startTagOther' |
| 5840 | }; |
| 5841 | |
| 5842 | modes.inRow.end_tag_handlers = { |
| 5843 | tr: 'endTagTr', |
| 5844 | table: 'endTagTable', |
| 5845 | tbody: 'endTagTableRowGroup', |
| 5846 | tfoot: 'endTagTableRowGroup', |
| 5847 | thead: 'endTagTableRowGroup', |
| 5848 | body: 'endTagIgnore', |
| 5849 | caption: 'endTagIgnore', |
| 5850 | col: 'endTagIgnore', |
| 5851 | colgroup: 'endTagIgnore', |
| 5852 | html: 'endTagIgnore', |
| 5853 | td: 'endTagIgnore', |
| 5854 | th: 'endTagIgnore', |
| 5855 | '-default': 'endTagOther' |
| 5856 | }; |
| 5857 | |
| 5858 | modes.inRow.processCharacters = function(data) { |
| 5859 | modes.inTable.processCharacters(data); |
| 5860 | }; |
| 5861 | |
| 5862 | modes.inRow.startTagTableCell = function(name, attributes) { |
| 5863 | tree.openElements.popUntilTableRowScopeMarker(); |
| 5864 | tree.insertElement(name, attributes); |
| 5865 | tree.setInsertionMode('inCell'); |
| 5866 | tree.activeFormattingElements.push(Marker); |
| 5867 | }; |
| 5868 | |
| 5869 | modes.inRow.startTagTableOther = function(name, attributes) { |
| 5870 | var ignoreEndTag = this.ignoreEndTagTr(); |
| 5871 | this.endTagTr('tr'); |
| 5872 | if (!ignoreEndTag) tree.insertionMode.processStartTag(name, attributes); |
| 5873 | }; |
| 5874 | |
| 5875 | modes.inRow.startTagOther = function(name, attributes, selfClosing) { |
| 5876 | modes.inTable.processStartTag(name, attributes, selfClosing); |
| 5877 | }; |
| 5878 | |
| 5879 | modes.inRow.endTagTr = function(name) { |
| 5880 | if (this.ignoreEndTagTr()) { |
| 5881 | assert.ok(tree.context); |
| 5882 | tree.parseError('unexpected-end-tag', {name: name}); |
| 5883 | } else { |
| 5884 | tree.openElements.popUntilTableRowScopeMarker(); |
| 5885 | tree.popElement(); |
| 5886 | tree.setInsertionMode('inTableBody'); |
| 5887 | } |
| 5888 | }; |
| 5889 | |
| 5890 | modes.inRow.endTagTable = function(name) { |
| 5891 | var ignoreEndTag = this.ignoreEndTagTr(); |
| 5892 | this.endTagTr('tr'); |
| 5893 | if (!ignoreEndTag) tree.insertionMode.processEndTag(name); |
| 5894 | }; |
| 5895 | |
| 5896 | modes.inRow.endTagTableRowGroup = function(name) { |
| 5897 | if (tree.openElements.inTableScope(name)) { |
| 5898 | this.endTagTr('tr'); |
| 5899 | tree.insertionMode.processEndTag(name); |
| 5900 | } else { |
| 5901 | tree.parseError('unexpected-end-tag', {name: name}); |
| 5902 | } |
| 5903 | }; |
| 5904 | |
| 5905 | modes.inRow.endTagIgnore = function(name) { |
| 5906 | tree.parseError("unexpected-end-tag-in-table-row", {name: name}); |
| 5907 | }; |
| 5908 | |
| 5909 | modes.inRow.endTagOther = function(name) { |
| 5910 | modes.inTable.processEndTag(name); |
| 5911 | }; |
| 5912 | |
| 5913 | modes.inRow.ignoreEndTagTr = function() { |
| 5914 | return !tree.openElements.inTableScope('tr'); |
| 5915 | }; |
| 5916 | |
| 5917 | modes.afterAfterFrameset = Object.create(modes.base); |
| 5918 | |
| 5919 | modes.afterAfterFrameset.start_tag_handlers = { |
| 5920 | html: 'startTagHtml', |
| 5921 | noframes: 'startTagNoFrames', |
| 5922 | '-default': 'startTagOther' |
| 5923 | }; |
| 5924 | |
| 5925 | modes.afterAfterFrameset.processEOF = function() {}; |
| 5926 | |
| 5927 | modes.afterAfterFrameset.processComment = function(data) { |
| 5928 | tree.insertComment(data, tree.document); |
| 5929 | }; |
| 5930 | |
| 5931 | modes.afterAfterFrameset.processCharacters = function(buffer) { |
| 5932 | var characters = buffer.takeRemaining(); |
| 5933 | var whitespace = ""; |
| 5934 | for (var i = 0; i < characters.length; i++) { |
| 5935 | var ch = characters[i]; |
| 5936 | if (isWhitespace(ch)) |
| 5937 | whitespace += ch; |
| 5938 | } |
| 5939 | if (whitespace) { |
| 5940 | tree.reconstructActiveFormattingElements(); |
| 5941 | tree.insertText(whitespace); |
| 5942 | } |
| 5943 | if (whitespace.length < characters.length) |
| 5944 | tree.parseError('expected-eof-but-got-char'); |
| 5945 | }; |
| 5946 | |
| 5947 | modes.afterAfterFrameset.startTagNoFrames = function(name, attributes) { |
| 5948 | modes.inHead.processStartTag(name, attributes); |
| 5949 | }; |
| 5950 | |
| 5951 | modes.afterAfterFrameset.startTagOther = function(name, attributes, selfClosing) { |
| 5952 | tree.parseError('expected-eof-but-got-start-tag', {name: name}); |
| 5953 | }; |
| 5954 | |
| 5955 | modes.afterAfterFrameset.processEndTag = function(name, attributes) { |
| 5956 | tree.parseError('expected-eof-but-got-end-tag', {name: name}); |
| 5957 | }; |
| 5958 | |
| 5959 | modes.text = Object.create(modes.base); |
| 5960 | |
| 5961 | modes.text.start_tag_handlers = { |
| 5962 | '-default': 'startTagOther' |
| 5963 | }; |
| 5964 | |
| 5965 | modes.text.end_tag_handlers = { |
| 5966 | script: 'endTagScript', |
| 5967 | '-default': 'endTagOther' |
| 5968 | }; |
| 5969 | |
| 5970 | modes.text.processCharacters = function(buffer) { |
| 5971 | if (tree.shouldSkipLeadingNewline) { |
| 5972 | tree.shouldSkipLeadingNewline = false; |
| 5973 | buffer.skipAtMostOneLeadingNewline(); |
| 5974 | } |
| 5975 | var data = buffer.takeRemaining(); |
| 5976 | if (!data) |
| 5977 | return; |
| 5978 | tree.insertText(data); |
| 5979 | }; |
| 5980 | |
| 5981 | modes.text.processEOF = function() { |
| 5982 | tree.parseError("expected-named-closing-tag-but-got-eof", |
| 5983 | {name: tree.currentStackItem().localName}); |
| 5984 | tree.openElements.pop(); |
| 5985 | tree.setInsertionMode(tree.originalInsertionMode); |
| 5986 | tree.insertionMode.processEOF(); |
| 5987 | }; |
| 5988 | |
| 5989 | modes.text.startTagOther = function(name) { |
| 5990 | throw "Tried to process start tag " + name + " in RCDATA/RAWTEXT mode"; |
| 5991 | }; |
| 5992 | |
| 5993 | modes.text.endTagScript = function(name) { |
| 5994 | var node = tree.openElements.pop(); |
| 5995 | assert.ok(node.localName == 'script'); |
| 5996 | tree.setInsertionMode(tree.originalInsertionMode); |
| 5997 | }; |
| 5998 | |
| 5999 | modes.text.endTagOther = function(name) { |
| 6000 | tree.openElements.pop(); |
| 6001 | tree.setInsertionMode(tree.originalInsertionMode); |
| 6002 | }; |
| 6003 | } |
| 6004 | |
| 6005 | TreeBuilder.prototype.setInsertionMode = function(name) { |
| 6006 | this.insertionMode = this.insertionModes[name]; |
| 6007 | this.insertionModeName = name; |
| 6008 | }; |
| 6009 | TreeBuilder.prototype.adoptionAgencyEndTag = function(name) { |
| 6010 | var outerIterationLimit = 8; |
| 6011 | var innerIterationLimit = 3; |
| 6012 | var formattingElement; |
| 6013 | |
| 6014 | function isActiveFormattingElement(el) { |
| 6015 | return el === formattingElement; |
| 6016 | } |
| 6017 | |
| 6018 | var outerLoopCounter = 0; |
| 6019 | |
| 6020 | while (outerLoopCounter++ < outerIterationLimit) { |
| 6021 | formattingElement = this.elementInActiveFormattingElements(name); |
| 6022 | |
| 6023 | if (!formattingElement || (this.openElements.contains(formattingElement) && !this.openElements.inScope(formattingElement.localName))) { |
| 6024 | this.parseError('adoption-agency-1.1', {name: name}); |
| 6025 | return false; |
| 6026 | } |
| 6027 | if (!this.openElements.contains(formattingElement)) { |
| 6028 | this.parseError('adoption-agency-1.2', {name: name}); |
| 6029 | this.removeElementFromActiveFormattingElements(formattingElement); |
| 6030 | return true; |
| 6031 | } |
| 6032 | if (!this.openElements.inScope(formattingElement.localName)) { |
| 6033 | this.parseError('adoption-agency-4.4', {name: name}); |
| 6034 | } |
| 6035 | |
| 6036 | if (formattingElement != this.currentStackItem()) { |
| 6037 | this.parseError('adoption-agency-1.3', {name: name}); |
| 6038 | } |
| 6039 | var furthestBlock = this.openElements.furthestBlockForFormattingElement(formattingElement.node); |
| 6040 | |
| 6041 | if (!furthestBlock) { |
| 6042 | this.openElements.remove_openElements_until(isActiveFormattingElement); |
| 6043 | this.removeElementFromActiveFormattingElements(formattingElement); |
| 6044 | return true; |
| 6045 | } |
| 6046 | |
| 6047 | var afeIndex = this.openElements.elements.indexOf(formattingElement); |
| 6048 | var commonAncestor = this.openElements.item(afeIndex - 1); |
| 6049 | |
| 6050 | var bookmark = this.activeFormattingElements.indexOf(formattingElement); |
| 6051 | |
| 6052 | var node = furthestBlock; |
| 6053 | var lastNode = furthestBlock; |
| 6054 | var index = this.openElements.elements.indexOf(node); |
| 6055 | |
| 6056 | var innerLoopCounter = 0; |
| 6057 | while (innerLoopCounter++ < innerIterationLimit) { |
| 6058 | index -= 1; |
| 6059 | node = this.openElements.item(index); |
| 6060 | if (this.activeFormattingElements.indexOf(node) < 0) { |
| 6061 | this.openElements.elements.splice(index, 1); |
| 6062 | continue; |
| 6063 | } |
| 6064 | if (node == formattingElement) |
| 6065 | break; |
| 6066 | |
| 6067 | if (lastNode == furthestBlock) |
| 6068 | bookmark = this.activeFormattingElements.indexOf(node) + 1; |
| 6069 | |
| 6070 | var clone = this.createElement(node.namespaceURI, node.localName, node.attributes); |
| 6071 | var newNode = new StackItem(node.namespaceURI, node.localName, node.attributes, clone); |
| 6072 | |
| 6073 | this.activeFormattingElements[this.activeFormattingElements.indexOf(node)] = newNode; |
| 6074 | this.openElements.elements[this.openElements.elements.indexOf(node)] = newNode; |
| 6075 | |
| 6076 | node = newNode; |
| 6077 | this.detachFromParent(lastNode.node); |
| 6078 | this.attachNode(lastNode.node, node.node); |
| 6079 | lastNode = node; |
| 6080 | } |
| 6081 | |
| 6082 | this.detachFromParent(lastNode.node); |
| 6083 | if (commonAncestor.isFosterParenting()) { |
| 6084 | this.insertIntoFosterParent(lastNode.node); |
| 6085 | } else { |
| 6086 | this.attachNode(lastNode.node, commonAncestor.node); |
| 6087 | } |
| 6088 | |
| 6089 | var clone = this.createElement("http://www.w3.org/1999/xhtml", formattingElement.localName, formattingElement.attributes); |
| 6090 | var formattingClone = new StackItem(formattingElement.namespaceURI, formattingElement.localName, formattingElement.attributes, clone); |
| 6091 | |
| 6092 | this.reparentChildren(furthestBlock.node, clone); |
| 6093 | this.attachNode(clone, furthestBlock.node); |
| 6094 | |
| 6095 | this.removeElementFromActiveFormattingElements(formattingElement); |
| 6096 | this.activeFormattingElements.splice(Math.min(bookmark, this.activeFormattingElements.length), 0, formattingClone); |
| 6097 | |
| 6098 | this.openElements.remove(formattingElement); |
| 6099 | this.openElements.elements.splice(this.openElements.elements.indexOf(furthestBlock) + 1, 0, formattingClone); |
| 6100 | } |
| 6101 | |
| 6102 | return true; |
| 6103 | }; |
| 6104 | |
| 6105 | TreeBuilder.prototype.start = function() { |
| 6106 | throw "Not mplemented"; |
| 6107 | }; |
| 6108 | |
| 6109 | TreeBuilder.prototype.startTokenization = function(tokenizer) { |
| 6110 | this.tokenizer = tokenizer; |
| 6111 | this.compatMode = "no quirks"; |
| 6112 | this.originalInsertionMode = "initial"; |
| 6113 | this.framesetOk = true; |
| 6114 | this.openElements = new ElementStack(); |
| 6115 | this.activeFormattingElements = []; |
| 6116 | this.start(); |
| 6117 | if (this.context) { |
| 6118 | switch(this.context) { |
| 6119 | case 'title': |
| 6120 | case 'textarea': |
| 6121 | this.tokenizer.setState(Tokenizer.RCDATA); |
| 6122 | break; |
| 6123 | case 'style': |
| 6124 | case 'xmp': |
| 6125 | case 'iframe': |
| 6126 | case 'noembed': |
| 6127 | case 'noframes': |
| 6128 | this.tokenizer.setState(Tokenizer.RAWTEXT); |
| 6129 | break; |
| 6130 | case 'script': |
| 6131 | this.tokenizer.setState(Tokenizer.SCRIPT_DATA); |
| 6132 | break; |
| 6133 | case 'noscript': |
| 6134 | if (this.scriptingEnabled) |
| 6135 | this.tokenizer.setState(Tokenizer.RAWTEXT); |
| 6136 | break; |
| 6137 | case 'plaintext': |
| 6138 | this.tokenizer.setState(Tokenizer.PLAINTEXT); |
| 6139 | break; |
| 6140 | } |
| 6141 | this.insertHtmlElement(); |
| 6142 | this.resetInsertionMode(); |
| 6143 | } else { |
| 6144 | this.setInsertionMode('initial'); |
| 6145 | } |
| 6146 | }; |
| 6147 | |
| 6148 | TreeBuilder.prototype.processToken = function(token) { |
| 6149 | this.selfClosingFlagAcknowledged = false; |
| 6150 | |
| 6151 | var currentNode = this.openElements.top || null; |
| 6152 | var insertionMode; |
| 6153 | if (!currentNode || !currentNode.isForeign() || |
| 6154 | (currentNode.isMathMLTextIntegrationPoint() && |
| 6155 | ((token.type == 'StartTag' && |
| 6156 | !(token.name in {mglyph:0, malignmark:0})) || |
| 6157 | (token.type === 'Characters')) |
| 6158 | ) || |
| 6159 | (currentNode.namespaceURI == "http://www.w3.org/1998/Math/MathML" && |
| 6160 | currentNode.localName == 'annotation-xml' && |
| 6161 | token.type == 'StartTag' && token.name == 'svg' |
| 6162 | ) || |
| 6163 | (currentNode.isHtmlIntegrationPoint() && |
| 6164 | token.type in {StartTag:0, Characters:0} |
| 6165 | ) || |
| 6166 | token.type == 'EOF' |
| 6167 | ) { |
| 6168 | insertionMode = this.insertionMode; |
| 6169 | } else { |
| 6170 | insertionMode = this.insertionModes.inForeignContent; |
| 6171 | } |
| 6172 | switch(token.type) { |
| 6173 | case 'Characters': |
| 6174 | var buffer = new CharacterBuffer(token.data); |
| 6175 | insertionMode.processCharacters(buffer); |
| 6176 | break; |
| 6177 | case 'Comment': |
| 6178 | insertionMode.processComment(token.data); |
| 6179 | break; |
| 6180 | case 'StartTag': |
| 6181 | insertionMode.processStartTag(token.name, token.data, token.selfClosing); |
| 6182 | break; |
| 6183 | case 'EndTag': |
| 6184 | insertionMode.processEndTag(token.name); |
| 6185 | break; |
| 6186 | case 'Doctype': |
| 6187 | insertionMode.processDoctype(token.name, token.publicId, token.systemId, token.forceQuirks); |
| 6188 | break; |
| 6189 | case 'EOF': |
| 6190 | insertionMode.processEOF(); |
| 6191 | break; |
| 6192 | } |
| 6193 | }; |
| 6194 | TreeBuilder.prototype.isCdataSectionAllowed = function() { |
| 6195 | return this.openElements.length > 0 && this.currentStackItem().isForeign(); |
| 6196 | }; |
| 6197 | TreeBuilder.prototype.isSelfClosingFlagAcknowledged = function() { |
| 6198 | return this.selfClosingFlagAcknowledged; |
| 6199 | }; |
| 6200 | |
| 6201 | TreeBuilder.prototype.createElement = function(namespaceURI, localName, attributes) { |
| 6202 | throw new Error("Not implemented"); |
| 6203 | }; |
| 6204 | |
| 6205 | TreeBuilder.prototype.attachNode = function(child, parent) { |
| 6206 | throw new Error("Not implemented"); |
| 6207 | }; |
| 6208 | |
| 6209 | TreeBuilder.prototype.attachNodeToFosterParent = function(child, table, stackParent) { |
| 6210 | throw new Error("Not implemented"); |
| 6211 | }; |
| 6212 | |
| 6213 | TreeBuilder.prototype.detachFromParent = function(node) { |
| 6214 | throw new Error("Not implemented"); |
| 6215 | }; |
| 6216 | |
| 6217 | TreeBuilder.prototype.addAttributesToElement = function(element, attributes) { |
| 6218 | throw new Error("Not implemented"); |
| 6219 | }; |
| 6220 | |
| 6221 | TreeBuilder.prototype.insertHtmlElement = function(attributes) { |
| 6222 | var root = this.createElement("http://www.w3.org/1999/xhtml", 'html', attributes); |
| 6223 | this.attachNode(root, this.document); |
| 6224 | this.openElements.pushHtmlElement(new StackItem("http://www.w3.org/1999/xhtml", 'html', attributes, root)); |
| 6225 | return root; |
| 6226 | }; |
| 6227 | |
| 6228 | TreeBuilder.prototype.insertHeadElement = function(attributes) { |
| 6229 | var element = this.createElement("http://www.w3.org/1999/xhtml", "head", attributes); |
| 6230 | this.head = new StackItem("http://www.w3.org/1999/xhtml", "head", attributes, element); |
| 6231 | this.attachNode(element, this.openElements.top.node); |
| 6232 | this.openElements.pushHeadElement(this.head); |
| 6233 | return element; |
| 6234 | }; |
| 6235 | |
| 6236 | TreeBuilder.prototype.insertBodyElement = function(attributes) { |
| 6237 | var element = this.createElement("http://www.w3.org/1999/xhtml", "body", attributes); |
| 6238 | this.attachNode(element, this.openElements.top.node); |
| 6239 | this.openElements.pushBodyElement(new StackItem("http://www.w3.org/1999/xhtml", "body", attributes, element)); |
| 6240 | return element; |
| 6241 | }; |
| 6242 | |
| 6243 | TreeBuilder.prototype.insertIntoFosterParent = function(node) { |
| 6244 | var tableIndex = this.openElements.findIndex('table'); |
| 6245 | var tableElement = this.openElements.item(tableIndex).node; |
| 6246 | if (tableIndex === 0) |
| 6247 | return this.attachNode(node, tableElement); |
| 6248 | this.attachNodeToFosterParent(node, tableElement, this.openElements.item(tableIndex - 1).node); |
| 6249 | }; |
| 6250 | |
| 6251 | TreeBuilder.prototype.insertElement = function(name, attributes, namespaceURI, selfClosing) { |
| 6252 | if (!namespaceURI) |
| 6253 | namespaceURI = "http://www.w3.org/1999/xhtml"; |
| 6254 | var element = this.createElement(namespaceURI, name, attributes); |
| 6255 | if (this.shouldFosterParent()) |
| 6256 | this.insertIntoFosterParent(element); |
| 6257 | else |
| 6258 | this.attachNode(element, this.openElements.top.node); |
| 6259 | if (!selfClosing) |
| 6260 | this.openElements.push(new StackItem(namespaceURI, name, attributes, element)); |
| 6261 | }; |
| 6262 | |
| 6263 | TreeBuilder.prototype.insertFormattingElement = function(name, attributes) { |
| 6264 | this.insertElement(name, attributes, "http://www.w3.org/1999/xhtml"); |
| 6265 | this.appendElementToActiveFormattingElements(this.currentStackItem()); |
| 6266 | }; |
| 6267 | |
| 6268 | TreeBuilder.prototype.insertSelfClosingElement = function(name, attributes) { |
| 6269 | this.selfClosingFlagAcknowledged = true; |
| 6270 | this.insertElement(name, attributes, "http://www.w3.org/1999/xhtml", true); |
| 6271 | }; |
| 6272 | |
| 6273 | TreeBuilder.prototype.insertForeignElement = function(name, attributes, namespaceURI, selfClosing) { |
| 6274 | if (selfClosing) |
| 6275 | this.selfClosingFlagAcknowledged = true; |
| 6276 | this.insertElement(name, attributes, namespaceURI, selfClosing); |
| 6277 | }; |
| 6278 | |
| 6279 | TreeBuilder.prototype.insertComment = function(data, parent) { |
| 6280 | throw new Error("Not implemented"); |
| 6281 | }; |
| 6282 | |
| 6283 | TreeBuilder.prototype.insertDoctype = function(name, publicId, systemId) { |
| 6284 | throw new Error("Not implemented"); |
| 6285 | }; |
| 6286 | |
| 6287 | TreeBuilder.prototype.insertText = function(data) { |
| 6288 | throw new Error("Not implemented"); |
| 6289 | }; |
| 6290 | TreeBuilder.prototype.currentStackItem = function() { |
| 6291 | return this.openElements.top; |
| 6292 | }; |
| 6293 | TreeBuilder.prototype.popElement = function() { |
| 6294 | return this.openElements.pop(); |
| 6295 | }; |
| 6296 | TreeBuilder.prototype.shouldFosterParent = function() { |
| 6297 | return this.redirectAttachToFosterParent && this.currentStackItem().isFosterParenting(); |
| 6298 | }; |
| 6299 | TreeBuilder.prototype.generateImpliedEndTags = function(exclude) { |
| 6300 | var name = this.openElements.top.localName; |
| 6301 | if (['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'].indexOf(name) != -1 && name != exclude) { |
| 6302 | this.popElement(); |
| 6303 | this.generateImpliedEndTags(exclude); |
| 6304 | } |
| 6305 | }; |
| 6306 | TreeBuilder.prototype.reconstructActiveFormattingElements = function() { |
| 6307 | if (this.activeFormattingElements.length === 0) |
| 6308 | return; |
| 6309 | var i = this.activeFormattingElements.length - 1; |
| 6310 | var entry = this.activeFormattingElements[i]; |
| 6311 | if (entry == Marker || this.openElements.contains(entry)) |
| 6312 | return; |
| 6313 | |
| 6314 | while (entry != Marker && !this.openElements.contains(entry)) { |
| 6315 | i -= 1; |
| 6316 | entry = this.activeFormattingElements[i]; |
| 6317 | if (!entry) |
| 6318 | break; |
| 6319 | } |
| 6320 | |
| 6321 | while (true) { |
| 6322 | i += 1; |
| 6323 | entry = this.activeFormattingElements[i]; |
| 6324 | this.insertElement(entry.localName, entry.attributes); |
| 6325 | var element = this.currentStackItem(); |
| 6326 | this.activeFormattingElements[i] = element; |
| 6327 | if (element == this.activeFormattingElements[this.activeFormattingElements.length -1]) |
| 6328 | break; |
| 6329 | } |
| 6330 | |
| 6331 | }; |
| 6332 | TreeBuilder.prototype.ensureNoahsArkCondition = function(item) { |
| 6333 | var kNoahsArkCapacity = 3; |
| 6334 | if (this.activeFormattingElements.length < kNoahsArkCapacity) |
| 6335 | return; |
| 6336 | var candidates = []; |
| 6337 | var newItemAttributeCount = item.attributes.length; |
| 6338 | for (var i = this.activeFormattingElements.length - 1; i >= 0; i--) { |
| 6339 | var candidate = this.activeFormattingElements[i]; |
| 6340 | if (candidate === Marker) |
| 6341 | break; |
| 6342 | if (item.localName !== candidate.localName || item.namespaceURI !== candidate.namespaceURI) |
| 6343 | continue; |
| 6344 | if (candidate.attributes.length != newItemAttributeCount) |
| 6345 | continue; |
| 6346 | candidates.push(candidate); |
| 6347 | } |
| 6348 | if (candidates.length < kNoahsArkCapacity) |
| 6349 | return; |
| 6350 | |
| 6351 | var remainingCandidates = []; |
| 6352 | var attributes = item.attributes; |
| 6353 | for (var i = 0; i < attributes.length; i++) { |
| 6354 | var attribute = attributes[i]; |
| 6355 | |
| 6356 | for (var j = 0; j < candidates.length; j++) { |
| 6357 | var candidate = candidates[j]; |
| 6358 | var candidateAttribute = getAttribute(candidate, attribute.nodeName); |
| 6359 | if (candidateAttribute && candidateAttribute.nodeValue === attribute.nodeValue) |
| 6360 | remainingCandidates.push(candidate); |
| 6361 | } |
| 6362 | if (remainingCandidates.length < kNoahsArkCapacity) |
| 6363 | return; |
| 6364 | candidates = remainingCandidates; |
| 6365 | remainingCandidates = []; |
| 6366 | } |
| 6367 | for (var i = kNoahsArkCapacity - 1; i < candidates.length; i++) |
| 6368 | this.removeElementFromActiveFormattingElements(candidates[i]); |
| 6369 | }; |
| 6370 | TreeBuilder.prototype.appendElementToActiveFormattingElements = function(item) { |
| 6371 | this.ensureNoahsArkCondition(item); |
| 6372 | this.activeFormattingElements.push(item); |
| 6373 | }; |
| 6374 | TreeBuilder.prototype.removeElementFromActiveFormattingElements = function(item) { |
| 6375 | var index = this.activeFormattingElements.indexOf(item); |
| 6376 | if (index >= 0) |
| 6377 | this.activeFormattingElements.splice(index, 1); |
| 6378 | }; |
| 6379 | |
| 6380 | TreeBuilder.prototype.elementInActiveFormattingElements = function(name) { |
| 6381 | var els = this.activeFormattingElements; |
| 6382 | for (var i = els.length - 1; i >= 0; i--) { |
| 6383 | if (els[i] == Marker) break; |
| 6384 | if (els[i].localName == name) return els[i]; |
| 6385 | } |
| 6386 | return false; |
| 6387 | }; |
| 6388 | |
| 6389 | TreeBuilder.prototype.clearActiveFormattingElements = function() { |
| 6390 | while (!(this.activeFormattingElements.length === 0 || this.activeFormattingElements.pop() == Marker)); |
| 6391 | }; |
| 6392 | |
| 6393 | TreeBuilder.prototype.reparentChildren = function(oldParent, newParent) { |
| 6394 | throw new Error("Not implemented"); |
| 6395 | }; |
| 6396 | TreeBuilder.prototype.setFragmentContext = function(context) { |
| 6397 | this.context = context; |
| 6398 | }; |
| 6399 | TreeBuilder.prototype.parseError = function(code, args) { |
| 6400 | if (!this.errorHandler) |
| 6401 | return; |
| 6402 | var message = formatMessage(messages[code], args); |
| 6403 | this.errorHandler.error(message, this.tokenizer._inputStream.location(), code); |
| 6404 | }; |
| 6405 | TreeBuilder.prototype.resetInsertionMode = function() { |
| 6406 | var last = false; |
| 6407 | var node = null; |
| 6408 | for (var i = this.openElements.length - 1; i >= 0; i--) { |
| 6409 | node = this.openElements.item(i); |
| 6410 | if (i === 0) { |
| 6411 | assert.ok(this.context); |
| 6412 | last = true; |
| 6413 | node = new StackItem("http://www.w3.org/1999/xhtml", this.context, [], null); |
| 6414 | } |
| 6415 | |
| 6416 | if (node.namespaceURI === "http://www.w3.org/1999/xhtml") { |
| 6417 | if (node.localName === 'select') |
| 6418 | return this.setInsertionMode('inSelect'); |
| 6419 | if (node.localName === 'td' || node.localName === 'th') |
| 6420 | return this.setInsertionMode('inCell'); |
| 6421 | if (node.localName === 'tr') |
| 6422 | return this.setInsertionMode('inRow'); |
| 6423 | if (node.localName === 'tbody' || node.localName === 'thead' || node.localName === 'tfoot') |
| 6424 | return this.setInsertionMode('inTableBody'); |
| 6425 | if (node.localName === 'caption') |
| 6426 | return this.setInsertionMode('inCaption'); |
| 6427 | if (node.localName === 'colgroup') |
| 6428 | return this.setInsertionMode('inColumnGroup'); |
| 6429 | if (node.localName === 'table') |
| 6430 | return this.setInsertionMode('inTable'); |
| 6431 | if (node.localName === 'head' && !last) |
| 6432 | return this.setInsertionMode('inHead'); |
| 6433 | if (node.localName === 'body') |
| 6434 | return this.setInsertionMode('inBody'); |
| 6435 | if (node.localName === 'frameset') |
| 6436 | return this.setInsertionMode('inFrameset'); |
| 6437 | if (node.localName === 'html') |
| 6438 | if (!this.openElements.headElement) |
| 6439 | return this.setInsertionMode('beforeHead'); |
| 6440 | else |
| 6441 | return this.setInsertionMode('afterHead'); |
| 6442 | } |
| 6443 | |
| 6444 | if (last) |
| 6445 | return this.setInsertionMode('inBody'); |
| 6446 | } |
| 6447 | }; |
| 6448 | |
| 6449 | TreeBuilder.prototype.processGenericRCDATAStartTag = function(name, attributes) { |
| 6450 | this.insertElement(name, attributes); |
| 6451 | this.tokenizer.setState(Tokenizer.RCDATA); |
| 6452 | this.originalInsertionMode = this.insertionModeName; |
| 6453 | this.setInsertionMode('text'); |
| 6454 | }; |
| 6455 | |
| 6456 | TreeBuilder.prototype.processGenericRawTextStartTag = function(name, attributes) { |
| 6457 | this.insertElement(name, attributes); |
| 6458 | this.tokenizer.setState(Tokenizer.RAWTEXT); |
| 6459 | this.originalInsertionMode = this.insertionModeName; |
| 6460 | this.setInsertionMode('text'); |
| 6461 | }; |
| 6462 | |
| 6463 | TreeBuilder.prototype.adjustMathMLAttributes = function(attributes) { |
| 6464 | attributes.forEach(function(a) { |
| 6465 | a.namespaceURI = "http://www.w3.org/1998/Math/MathML"; |
| 6466 | if (constants.MATHMLAttributeMap[a.nodeName]) |
| 6467 | a.nodeName = constants.MATHMLAttributeMap[a.nodeName]; |
| 6468 | }); |
| 6469 | return attributes; |
| 6470 | }; |
| 6471 | |
| 6472 | TreeBuilder.prototype.adjustSVGTagNameCase = function(name) { |
| 6473 | return constants.SVGTagMap[name] || name; |
| 6474 | }; |
| 6475 | |
| 6476 | TreeBuilder.prototype.adjustSVGAttributes = function(attributes) { |
| 6477 | attributes.forEach(function(a) { |
| 6478 | a.namespaceURI = "http://www.w3.org/2000/svg"; |
| 6479 | if (constants.SVGAttributeMap[a.nodeName]) |
| 6480 | a.nodeName = constants.SVGAttributeMap[a.nodeName]; |
| 6481 | }); |
| 6482 | return attributes; |
| 6483 | }; |
| 6484 | |
| 6485 | TreeBuilder.prototype.adjustForeignAttributes = function(attributes) { |
| 6486 | for (var i = 0; i < attributes.length; i++) { |
| 6487 | var attribute = attributes[i]; |
| 6488 | var adjusted = constants.ForeignAttributeMap[attribute.nodeName]; |
| 6489 | if (adjusted) { |
| 6490 | attribute.nodeName = adjusted.localName; |
| 6491 | attribute.prefix = adjusted.prefix; |
| 6492 | attribute.namespaceURI = adjusted.namespaceURI; |
| 6493 | } |
| 6494 | } |
| 6495 | return attributes; |
| 6496 | }; |
| 6497 | |
| 6498 | function formatMessage(format, args) { |
| 6499 | return format.replace(new RegExp('{[0-9a-z-]+}', 'gi'), function(match) { |
| 6500 | return args[match.slice(1, -1)] || match; |
| 6501 | }); |
| 6502 | } |
| 6503 | |
| 6504 | exports.TreeBuilder = TreeBuilder; |
| 6505 | |
| 6506 | }, |
| 6507 | {"./ElementStack":1,"./StackItem":4,"./Tokenizer":5,"./constants":7,"./messages.json":8,"assert":13,"events":16}], |
| 6508 | 7:[function(_dereq_,module,exports){ |
| 6509 | exports.SVGTagMap = { |
| 6510 | "altglyph": "altGlyph", |
| 6511 | "altglyphdef": "altGlyphDef", |
| 6512 | "altglyphitem": "altGlyphItem", |
| 6513 | "animatecolor": "animateColor", |
| 6514 | "animatemotion": "animateMotion", |
| 6515 | "animatetransform": "animateTransform", |
| 6516 | "clippath": "clipPath", |
| 6517 | "feblend": "feBlend", |
| 6518 | "fecolormatrix": "feColorMatrix", |
| 6519 | "fecomponenttransfer": "feComponentTransfer", |
| 6520 | "fecomposite": "feComposite", |
| 6521 | "feconvolvematrix": "feConvolveMatrix", |
| 6522 | "fediffuselighting": "feDiffuseLighting", |
| 6523 | "fedisplacementmap": "feDisplacementMap", |
| 6524 | "fedistantlight": "feDistantLight", |
| 6525 | "feflood": "feFlood", |
| 6526 | "fefunca": "feFuncA", |
| 6527 | "fefuncb": "feFuncB", |
| 6528 | "fefuncg": "feFuncG", |
| 6529 | "fefuncr": "feFuncR", |
| 6530 | "fegaussianblur": "feGaussianBlur", |
| 6531 | "feimage": "feImage", |
| 6532 | "femerge": "feMerge", |
| 6533 | "femergenode": "feMergeNode", |
| 6534 | "femorphology": "feMorphology", |
| 6535 | "feoffset": "feOffset", |
| 6536 | "fepointlight": "fePointLight", |
| 6537 | "fespecularlighting": "feSpecularLighting", |
| 6538 | "fespotlight": "feSpotLight", |
| 6539 | "fetile": "feTile", |
| 6540 | "feturbulence": "feTurbulence", |
| 6541 | "foreignobject": "foreignObject", |
| 6542 | "glyphref": "glyphRef", |
| 6543 | "lineargradient": "linearGradient", |
| 6544 | "radialgradient": "radialGradient", |
| 6545 | "textpath": "textPath" |
| 6546 | }; |
| 6547 | |
| 6548 | exports.MATHMLAttributeMap = { |
| 6549 | definitionurl: 'definitionURL' |
| 6550 | }; |
| 6551 | |
| 6552 | exports.SVGAttributeMap = { |
| 6553 | attributename: 'attributeName', |
| 6554 | attributetype: 'attributeType', |
| 6555 | basefrequency: 'baseFrequency', |
| 6556 | baseprofile: 'baseProfile', |
| 6557 | calcmode: 'calcMode', |
| 6558 | clippathunits: 'clipPathUnits', |
| 6559 | contentscripttype: 'contentScriptType', |
| 6560 | contentstyletype: 'contentStyleType', |
| 6561 | diffuseconstant: 'diffuseConstant', |
| 6562 | edgemode: 'edgeMode', |
| 6563 | externalresourcesrequired: 'externalResourcesRequired', |
| 6564 | filterres: 'filterRes', |
| 6565 | filterunits: 'filterUnits', |
| 6566 | glyphref: 'glyphRef', |
| 6567 | gradienttransform: 'gradientTransform', |
| 6568 | gradientunits: 'gradientUnits', |
| 6569 | kernelmatrix: 'kernelMatrix', |
| 6570 | kernelunitlength: 'kernelUnitLength', |
| 6571 | keypoints: 'keyPoints', |
| 6572 | keysplines: 'keySplines', |
| 6573 | keytimes: 'keyTimes', |
| 6574 | lengthadjust: 'lengthAdjust', |
| 6575 | limitingconeangle: 'limitingConeAngle', |
| 6576 | markerheight: 'markerHeight', |
| 6577 | markerunits: 'markerUnits', |
| 6578 | markerwidth: 'markerWidth', |
| 6579 | maskcontentunits: 'maskContentUnits', |
| 6580 | maskunits: 'maskUnits', |
| 6581 | numoctaves: 'numOctaves', |
| 6582 | pathlength: 'pathLength', |
| 6583 | patterncontentunits: 'patternContentUnits', |
| 6584 | patterntransform: 'patternTransform', |
| 6585 | patternunits: 'patternUnits', |
| 6586 | pointsatx: 'pointsAtX', |
| 6587 | pointsaty: 'pointsAtY', |
| 6588 | pointsatz: 'pointsAtZ', |
| 6589 | preservealpha: 'preserveAlpha', |
| 6590 | preserveaspectratio: 'preserveAspectRatio', |
| 6591 | primitiveunits: 'primitiveUnits', |
| 6592 | refx: 'refX', |
| 6593 | refy: 'refY', |
| 6594 | repeatcount: 'repeatCount', |
| 6595 | repeatdur: 'repeatDur', |
| 6596 | requiredextensions: 'requiredExtensions', |
| 6597 | requiredfeatures: 'requiredFeatures', |
| 6598 | specularconstant: 'specularConstant', |
| 6599 | specularexponent: 'specularExponent', |
| 6600 | spreadmethod: 'spreadMethod', |
| 6601 | startoffset: 'startOffset', |
| 6602 | stddeviation: 'stdDeviation', |
| 6603 | stitchtiles: 'stitchTiles', |
| 6604 | surfacescale: 'surfaceScale', |
| 6605 | systemlanguage: 'systemLanguage', |
| 6606 | tablevalues: 'tableValues', |
| 6607 | targetx: 'targetX', |
| 6608 | targety: 'targetY', |
| 6609 | textlength: 'textLength', |
| 6610 | viewbox: 'viewBox', |
| 6611 | viewtarget: 'viewTarget', |
| 6612 | xchannelselector: 'xChannelSelector', |
| 6613 | ychannelselector: 'yChannelSelector', |
| 6614 | zoomandpan: 'zoomAndPan' |
| 6615 | }; |
| 6616 | |
| 6617 | exports.ForeignAttributeMap = { |
| 6618 | "xlink:actuate": {prefix: "xlink", localName: "actuate", namespaceURI: "http://www.w3.org/1999/xlink"}, |
| 6619 | "xlink:arcrole": {prefix: "xlink", localName: "arcrole", namespaceURI: "http://www.w3.org/1999/xlink"}, |
| 6620 | "xlink:href": {prefix: "xlink", localName: "href", namespaceURI: "http://www.w3.org/1999/xlink"}, |
| 6621 | "xlink:role": {prefix: "xlink", localName: "role", namespaceURI: "http://www.w3.org/1999/xlink"}, |
| 6622 | "xlink:show": {prefix: "xlink", localName: "show", namespaceURI: "http://www.w3.org/1999/xlink"}, |
| 6623 | "xlink:title": {prefix: "xlink", localName: "title", namespaceURI: "http://www.w3.org/1999/xlink"}, |
| 6624 | "xlink:type": {prefix: "xlink", localName: "title", namespaceURI: "http://www.w3.org/1999/xlink"}, |
| 6625 | "xml:base": {prefix: "xml", localName: "base", namespaceURI: "http://www.w3.org/XML/1998/namespace"}, |
| 6626 | "xml:lang": {prefix: "xml", localName: "lang", namespaceURI: "http://www.w3.org/XML/1998/namespace"}, |
| 6627 | "xml:space": {prefix: "xml", localName: "space", namespaceURI: "http://www.w3.org/XML/1998/namespace"}, |
| 6628 | "xmlns": {prefix: null, localName: "xmlns", namespaceURI: "http://www.w3.org/2000/xmlns/"}, |
| 6629 | "xmlns:xlink": {prefix: "xmlns", localName: "xlink", namespaceURI: "http://www.w3.org/2000/xmlns/"}, |
| 6630 | }; |
| 6631 | }, |
| 6632 | {}], |
| 6633 | 8:[function(_dereq_,module,exports){ |
| 6634 | module.exports={ |
| 6635 | "null-character": |
| 6636 | "Null character in input stream, replaced with U+FFFD.", |
| 6637 | "invalid-codepoint": |
| 6638 | "Invalid codepoint in stream", |
| 6639 | "incorrectly-placed-solidus": |
| 6640 | "Solidus (/) incorrectly placed in tag.", |
| 6641 | "incorrect-cr-newline-entity": |
| 6642 | "Incorrect CR newline entity, replaced with LF.", |
| 6643 | "illegal-windows-1252-entity": |
| 6644 | "Entity used with illegal number (windows-1252 reference).", |
| 6645 | "cant-convert-numeric-entity": |
| 6646 | "Numeric entity couldn't be converted to character (codepoint U+{charAsInt}).", |
| 6647 | "invalid-numeric-entity-replaced": |
| 6648 | "Numeric entity represents an illegal codepoint. Expanded to the C1 controls range.", |
| 6649 | "numeric-entity-without-semicolon": |
| 6650 | "Numeric entity didn't end with ';'.", |
| 6651 | "expected-numeric-entity-but-got-eof": |
| 6652 | "Numeric entity expected. Got end of file instead.", |
| 6653 | "expected-numeric-entity": |
| 6654 | "Numeric entity expected but none found.", |
| 6655 | "named-entity-without-semicolon": |
| 6656 | "Named entity didn't end with ';'.", |
| 6657 | "expected-named-entity": |
| 6658 | "Named entity expected. Got none.", |
| 6659 | "attributes-in-end-tag": |
| 6660 | "End tag contains unexpected attributes.", |
| 6661 | "self-closing-flag-on-end-tag": |
| 6662 | "End tag contains unexpected self-closing flag.", |
| 6663 | "bare-less-than-sign-at-eof": |
| 6664 | "End of file after <.", |
| 6665 | "expected-tag-name-but-got-right-bracket": |
| 6666 | "Expected tag name. Got '>' instead.", |
| 6667 | "expected-tag-name-but-got-question-mark": |
| 6668 | "Expected tag name. Got '?' instead. (HTML doesn't support processing instructions.)", |
| 6669 | "expected-tag-name": |
| 6670 | "Expected tag name. Got something else instead.", |
| 6671 | "expected-closing-tag-but-got-right-bracket": |
| 6672 | "Expected closing tag. Got '>' instead. Ignoring '</>'.", |
| 6673 | "expected-closing-tag-but-got-eof": |
| 6674 | "Expected closing tag. Unexpected end of file.", |
| 6675 | "expected-closing-tag-but-got-char": |
| 6676 | "Expected closing tag. Unexpected character '{data}' found.", |
| 6677 | "eof-in-tag-name": |
| 6678 | "Unexpected end of file in the tag name.", |
| 6679 | "expected-attribute-name-but-got-eof": |
| 6680 | "Unexpected end of file. Expected attribute name instead.", |
| 6681 | "eof-in-attribute-name": |
| 6682 | "Unexpected end of file in attribute name.", |
| 6683 | "invalid-character-in-attribute-name": |
| 6684 | "Invalid character in attribute name.", |
| 6685 | "duplicate-attribute": |
| 6686 | "Dropped duplicate attribute '{name}' on tag.", |
| 6687 | "expected-end-of-tag-but-got-eof": |
| 6688 | "Unexpected end of file. Expected = or end of tag.", |
| 6689 | "expected-attribute-value-but-got-eof": |
| 6690 | "Unexpected end of file. Expected attribute value.", |
| 6691 | "expected-attribute-value-but-got-right-bracket": |
| 6692 | "Expected attribute value. Got '>' instead.", |
| 6693 | "unexpected-character-in-unquoted-attribute-value": |
| 6694 | "Unexpected character in unquoted attribute", |
| 6695 | "invalid-character-after-attribute-name": |
| 6696 | "Unexpected character after attribute name.", |
| 6697 | "unexpected-character-after-attribute-value": |
| 6698 | "Unexpected character after attribute value.", |
| 6699 | "eof-in-attribute-value-double-quote": |
| 6700 | "Unexpected end of file in attribute value (\").", |
| 6701 | "eof-in-attribute-value-single-quote": |
| 6702 | "Unexpected end of file in attribute value (').", |
| 6703 | "eof-in-attribute-value-no-quotes": |
| 6704 | "Unexpected end of file in attribute value.", |
| 6705 | "eof-after-attribute-value": |
| 6706 | "Unexpected end of file after attribute value.", |
| 6707 | "unexpected-eof-after-solidus-in-tag": |
| 6708 | "Unexpected end of file in tag. Expected >.", |
| 6709 | "unexpected-character-after-solidus-in-tag": |
| 6710 | "Unexpected character after / in tag. Expected >.", |
| 6711 | "expected-dashes-or-doctype": |
| 6712 | "Expected '--' or 'DOCTYPE'. Not found.", |
| 6713 | "unexpected-bang-after-double-dash-in-comment": |
| 6714 | "Unexpected ! after -- in comment.", |
| 6715 | "incorrect-comment": |
| 6716 | "Incorrect comment.", |
| 6717 | "eof-in-comment": |
| 6718 | "Unexpected end of file in comment.", |
| 6719 | "eof-in-comment-end-dash": |
| 6720 | "Unexpected end of file in comment (-).", |
| 6721 | "unexpected-dash-after-double-dash-in-comment": |
| 6722 | "Unexpected '-' after '--' found in comment.", |
| 6723 | "eof-in-comment-double-dash": |
| 6724 | "Unexpected end of file in comment (--).", |
| 6725 | "eof-in-comment-end-bang-state": |
| 6726 | "Unexpected end of file in comment.", |
| 6727 | "unexpected-char-in-comment": |
| 6728 | "Unexpected character in comment found.", |
| 6729 | "need-space-after-doctype": |
| 6730 | "No space after literal string 'DOCTYPE'.", |
| 6731 | "expected-doctype-name-but-got-right-bracket": |
| 6732 | "Unexpected > character. Expected DOCTYPE name.", |
| 6733 | "expected-doctype-name-but-got-eof": |
| 6734 | "Unexpected end of file. Expected DOCTYPE name.", |
| 6735 | "eof-in-doctype-name": |
| 6736 | "Unexpected end of file in DOCTYPE name.", |
| 6737 | "eof-in-doctype": |
| 6738 | "Unexpected end of file in DOCTYPE.", |
| 6739 | "expected-space-or-right-bracket-in-doctype": |
| 6740 | "Expected space or '>'. Got '{data}'.", |
| 6741 | "unexpected-end-of-doctype": |
| 6742 | "Unexpected end of DOCTYPE.", |
| 6743 | "unexpected-char-in-doctype": |
| 6744 | "Unexpected character in DOCTYPE.", |
| 6745 | "eof-in-bogus-doctype": |
| 6746 | "Unexpected end of file in bogus doctype.", |
| 6747 | "eof-in-innerhtml": |
| 6748 | "Unexpected EOF in inner html mode.", |
| 6749 | "unexpected-doctype": |
| 6750 | "Unexpected DOCTYPE. Ignored.", |
| 6751 | "non-html-root": |
| 6752 | "html needs to be the first start tag.", |
| 6753 | "expected-doctype-but-got-eof": |
| 6754 | "Unexpected End of file. Expected DOCTYPE.", |
| 6755 | "unknown-doctype": |
| 6756 | "Erroneous DOCTYPE. Expected <!DOCTYPE html>.", |
| 6757 | "quirky-doctype": |
| 6758 | "Quirky doctype. Expected <!DOCTYPE html>.", |
| 6759 | "almost-standards-doctype": |
| 6760 | "Almost standards mode doctype. Expected <!DOCTYPE html>.", |
| 6761 | "obsolete-doctype": |
| 6762 | "Obsolete doctype. Expected <!DOCTYPE html>.", |
| 6763 | "expected-doctype-but-got-chars": |
| 6764 | "Non-space characters found without seeing a doctype first. Expected e.g. <!DOCTYPE html>.", |
| 6765 | "expected-doctype-but-got-start-tag": |
| 6766 | "Start tag seen without seeing a doctype first. Expected e.g. <!DOCTYPE html>.", |
| 6767 | "expected-doctype-but-got-end-tag": |
| 6768 | "End tag seen without seeing a doctype first. Expected e.g. <!DOCTYPE html>.", |
| 6769 | "end-tag-after-implied-root": |
| 6770 | "Unexpected end tag ({name}) after the (implied) root element.", |
| 6771 | "expected-named-closing-tag-but-got-eof": |
| 6772 | "Unexpected end of file. Expected end tag ({name}).", |
| 6773 | "two-heads-are-not-better-than-one": |
| 6774 | "Unexpected start tag head in existing head. Ignored.", |
| 6775 | "unexpected-end-tag": |
| 6776 | "Unexpected end tag ({name}). Ignored.", |
| 6777 | "unexpected-implied-end-tag": |
| 6778 | "End tag {name} implied, but there were open elements.", |
| 6779 | "unexpected-start-tag-out-of-my-head": |
| 6780 | "Unexpected start tag ({name}) that can be in head. Moved.", |
| 6781 | "unexpected-start-tag": |
| 6782 | "Unexpected start tag ({name}).", |
| 6783 | "missing-end-tag": |
| 6784 | "Missing end tag ({name}).", |
| 6785 | "missing-end-tags": |
| 6786 | "Missing end tags ({name}).", |
| 6787 | "unexpected-start-tag-implies-end-tag": |
| 6788 | "Unexpected start tag ({startName}) implies end tag ({endName}).", |
| 6789 | "unexpected-start-tag-treated-as": |
| 6790 | "Unexpected start tag ({originalName}). Treated as {newName}.", |
| 6791 | "deprecated-tag": |
| 6792 | "Unexpected start tag {name}. Don't use it!", |
| 6793 | "unexpected-start-tag-ignored": |
| 6794 | "Unexpected start tag {name}. Ignored.", |
| 6795 | "expected-one-end-tag-but-got-another": |
| 6796 | "Unexpected end tag ({gotName}). Missing end tag ({expectedName}).", |
| 6797 | "end-tag-too-early": |
| 6798 | "End tag ({name}) seen too early. Expected other end tag.", |
| 6799 | "end-tag-too-early-named": |
| 6800 | "Unexpected end tag ({gotName}). Expected end tag ({expectedName}.", |
| 6801 | "end-tag-too-early-ignored": |
| 6802 | "End tag ({name}) seen too early. Ignored.", |
| 6803 | "adoption-agency-1.1": |
| 6804 | "End tag ({name}) violates step 1, paragraph 1 of the adoption agency algorithm.", |
| 6805 | "adoption-agency-1.2": |
| 6806 | "End tag ({name}) violates step 1, paragraph 2 of the adoption agency algorithm.", |
| 6807 | "adoption-agency-1.3": |
| 6808 | "End tag ({name}) violates step 1, paragraph 3 of the adoption agency algorithm.", |
| 6809 | "adoption-agency-4.4": |
| 6810 | "End tag ({name}) violates step 4, paragraph 4 of the adoption agency algorithm.", |
| 6811 | "unexpected-end-tag-treated-as": |
| 6812 | "Unexpected end tag ({originalName}). Treated as {newName}.", |
| 6813 | "no-end-tag": |
| 6814 | "This element ({name}) has no end tag.", |
| 6815 | "unexpected-implied-end-tag-in-table": |
| 6816 | "Unexpected implied end tag ({name}) in the table phase.", |
| 6817 | "unexpected-implied-end-tag-in-table-body": |
| 6818 | "Unexpected implied end tag ({name}) in the table body phase.", |
| 6819 | "unexpected-char-implies-table-voodoo": |
| 6820 | "Unexpected non-space characters in table context caused voodoo mode.", |
| 6821 | "unexpected-hidden-input-in-table": |
| 6822 | "Unexpected input with type hidden in table context.", |
| 6823 | "unexpected-form-in-table": |
| 6824 | "Unexpected form in table context.", |
| 6825 | "unexpected-start-tag-implies-table-voodoo": |
| 6826 | "Unexpected start tag ({name}) in table context caused voodoo mode.", |
| 6827 | "unexpected-end-tag-implies-table-voodoo": |
| 6828 | "Unexpected end tag ({name}) in table context caused voodoo mode.", |
| 6829 | "unexpected-cell-in-table-body": |
| 6830 | "Unexpected table cell start tag ({name}) in the table body phase.", |
| 6831 | "unexpected-cell-end-tag": |
| 6832 | "Got table cell end tag ({name}) while required end tags are missing.", |
| 6833 | "unexpected-end-tag-in-table-body": |
| 6834 | "Unexpected end tag ({name}) in the table body phase. Ignored.", |
| 6835 | "unexpected-implied-end-tag-in-table-row": |
| 6836 | "Unexpected implied end tag ({name}) in the table row phase.", |
| 6837 | "unexpected-end-tag-in-table-row": |
| 6838 | "Unexpected end tag ({name}) in the table row phase. Ignored.", |
| 6839 | "unexpected-select-in-select": |
| 6840 | "Unexpected select start tag in the select phase treated as select end tag.", |
| 6841 | "unexpected-input-in-select": |
| 6842 | "Unexpected input start tag in the select phase.", |
| 6843 | "unexpected-start-tag-in-select": |
| 6844 | "Unexpected start tag token ({name}) in the select phase. Ignored.", |
| 6845 | "unexpected-end-tag-in-select": |
| 6846 | "Unexpected end tag ({name}) in the select phase. Ignored.", |
| 6847 | "unexpected-table-element-start-tag-in-select-in-table": |
| 6848 | "Unexpected table element start tag ({name}) in the select in table phase.", |
| 6849 | "unexpected-table-element-end-tag-in-select-in-table": |
| 6850 | "Unexpected table element end tag ({name}) in the select in table phase.", |
| 6851 | "unexpected-char-after-body": |
| 6852 | "Unexpected non-space characters in the after body phase.", |
| 6853 | "unexpected-start-tag-after-body": |
| 6854 | "Unexpected start tag token ({name}) in the after body phase.", |
| 6855 | "unexpected-end-tag-after-body": |
| 6856 | "Unexpected end tag token ({name}) in the after body phase.", |
| 6857 | "unexpected-char-in-frameset": |
| 6858 | "Unepxected characters in the frameset phase. Characters ignored.", |
| 6859 | "unexpected-start-tag-in-frameset": |
| 6860 | "Unexpected start tag token ({name}) in the frameset phase. Ignored.", |
| 6861 | "unexpected-frameset-in-frameset-innerhtml": |
| 6862 | "Unexpected end tag token (frameset in the frameset phase (innerHTML).", |
| 6863 | "unexpected-end-tag-in-frameset": |
| 6864 | "Unexpected end tag token ({name}) in the frameset phase. Ignored.", |
| 6865 | "unexpected-char-after-frameset": |
| 6866 | "Unexpected non-space characters in the after frameset phase. Ignored.", |
| 6867 | "unexpected-start-tag-after-frameset": |
| 6868 | "Unexpected start tag ({name}) in the after frameset phase. Ignored.", |
| 6869 | "unexpected-end-tag-after-frameset": |
| 6870 | "Unexpected end tag ({name}) in the after frameset phase. Ignored.", |
| 6871 | "expected-eof-but-got-char": |
| 6872 | "Unexpected non-space characters. Expected end of file.", |
| 6873 | "expected-eof-but-got-start-tag": |
| 6874 | "Unexpected start tag ({name}). Expected end of file.", |
| 6875 | "expected-eof-but-got-end-tag": |
| 6876 | "Unexpected end tag ({name}). Expected end of file.", |
| 6877 | "unexpected-end-table-in-caption": |
| 6878 | "Unexpected end table tag in caption. Generates implied end caption.", |
| 6879 | "end-html-in-innerhtml": |
| 6880 | "Unexpected html end tag in inner html mode.", |
| 6881 | "eof-in-table": |
| 6882 | "Unexpected end of file. Expected table content.", |
| 6883 | "eof-in-script": |
| 6884 | "Unexpected end of file. Expected script content.", |
| 6885 | "non-void-element-with-trailing-solidus": |
| 6886 | "Trailing solidus not allowed on element {name}.", |
| 6887 | "unexpected-html-element-in-foreign-content": |
| 6888 | "HTML start tag \"{name}\" in a foreign namespace context.", |
| 6889 | "unexpected-start-tag-in-table": |
| 6890 | "Unexpected {name}. Expected table content." |
| 6891 | } |
| 6892 | }, |
| 6893 | {}], |
| 6894 | 9:[function(_dereq_,module,exports){ |
| 6895 | var SAXTreeBuilder = _dereq_('./SAXTreeBuilder').SAXTreeBuilder; |
| 6896 | var Tokenizer = _dereq_('../Tokenizer').Tokenizer; |
| 6897 | var TreeParser = _dereq_('./TreeParser').TreeParser; |
| 6898 | |
| 6899 | function SAXParser() { |
| 6900 | this.contentHandler = null; |
| 6901 | this._errorHandler = null; |
| 6902 | this._treeBuilder = new SAXTreeBuilder(); |
| 6903 | this._tokenizer = new Tokenizer(this._treeBuilder); |
| 6904 | this._scriptingEnabled = false; |
| 6905 | } |
| 6906 | |
| 6907 | SAXParser.prototype.parse = function(source) { |
| 6908 | this._tokenizer.tokenize(source); |
| 6909 | var document = this._treeBuilder.document; |
| 6910 | if (document) { |
| 6911 | new TreeParser(this.contentHandler).parse(document); |
| 6912 | } |
| 6913 | }; |
| 6914 | |
| 6915 | SAXParser.prototype.parseFragment = function(source, context) { |
| 6916 | this._treeBuilder.setFragmentContext(context); |
| 6917 | this._tokenizer.tokenize(source); |
| 6918 | var fragment = this._treeBuilder.getFragment(); |
| 6919 | if (fragment) { |
| 6920 | new TreeParser(this.contentHandler).parse(fragment); |
| 6921 | } |
| 6922 | }; |
| 6923 | |
| 6924 | Object.defineProperty(SAXParser.prototype, 'scriptingEnabled', { |
| 6925 | get: function() { |
| 6926 | return this._scriptingEnabled; |
| 6927 | }, |
| 6928 | set: function(value) { |
| 6929 | this._scriptingEnabled = value; |
| 6930 | this._treeBuilder.scriptingEnabled = value; |
| 6931 | } |
| 6932 | }); |
| 6933 | |
| 6934 | Object.defineProperty(SAXParser.prototype, 'errorHandler', { |
| 6935 | get: function() { |
| 6936 | return this._errorHandler; |
| 6937 | }, |
| 6938 | set: function(value) { |
| 6939 | this._errorHandler = value; |
| 6940 | this._treeBuilder.errorHandler = value; |
| 6941 | } |
| 6942 | }); |
| 6943 | |
| 6944 | exports.SAXParser = SAXParser; |
| 6945 | |
| 6946 | }, |
| 6947 | {"../Tokenizer":5,"./SAXTreeBuilder":10,"./TreeParser":11}], |
| 6948 | 10:[function(_dereq_,module,exports){ |
| 6949 | var util = _dereq_('util'); |
| 6950 | var TreeBuilder = _dereq_('../TreeBuilder').TreeBuilder; |
| 6951 | |
| 6952 | function SAXTreeBuilder() { |
| 6953 | TreeBuilder.call(this); |
| 6954 | } |
| 6955 | |
| 6956 | util.inherits(SAXTreeBuilder, TreeBuilder); |
| 6957 | |
| 6958 | SAXTreeBuilder.prototype.start = function(tokenizer) { |
| 6959 | this.document = new Document(this.tokenizer); |
| 6960 | }; |
| 6961 | |
| 6962 | SAXTreeBuilder.prototype.end = function() { |
| 6963 | this.document.endLocator = this.tokenizer; |
| 6964 | }; |
| 6965 | |
| 6966 | SAXTreeBuilder.prototype.insertDoctype = function(name, publicId, systemId) { |
| 6967 | var doctype = new DTD(this.tokenizer, name, publicId, systemId); |
| 6968 | doctype.endLocator = this.tokenizer; |
| 6969 | this.document.appendChild(doctype); |
| 6970 | }; |
| 6971 | |
| 6972 | SAXTreeBuilder.prototype.createElement = function(namespaceURI, localName, attributes) { |
| 6973 | var element = new Element(this.tokenizer, namespaceURI, localName, localName, attributes || []); |
| 6974 | return element; |
| 6975 | }; |
| 6976 | |
| 6977 | SAXTreeBuilder.prototype.insertComment = function(data, parent) { |
| 6978 | if (!parent) |
| 6979 | parent = this.currentStackItem(); |
| 6980 | var comment = new Comment(this.tokenizer, data); |
| 6981 | parent.appendChild(comment); |
| 6982 | }; |
| 6983 | |
| 6984 | SAXTreeBuilder.prototype.appendCharacters = function(parent, data) { |
| 6985 | var text = new Characters(this.tokenizer, data); |
| 6986 | parent.appendChild(text); |
| 6987 | }; |
| 6988 | |
| 6989 | SAXTreeBuilder.prototype.insertText = function(data) { |
| 6990 | if (this.redirectAttachToFosterParent && this.openElements.top.isFosterParenting()) { |
| 6991 | var tableIndex = this.openElements.findIndex('table'); |
| 6992 | var tableItem = this.openElements.item(tableIndex); |
| 6993 | var table = tableItem.node; |
| 6994 | if (tableIndex === 0) { |
| 6995 | return this.appendCharacters(table, data); |
| 6996 | } |
| 6997 | var text = new Characters(this.tokenizer, data); |
| 6998 | var parent = table.parentNode; |
| 6999 | if (parent) { |
| 7000 | parent.insertBetween(text, table.previousSibling, table); |
| 7001 | return; |
| 7002 | } |
| 7003 | var stackParent = this.openElements.item(tableIndex - 1).node; |
| 7004 | stackParent.appendChild(text); |
| 7005 | return; |
| 7006 | } |
| 7007 | this.appendCharacters(this.currentStackItem().node, data); |
| 7008 | }; |
| 7009 | |
| 7010 | SAXTreeBuilder.prototype.attachNode = function(node, parent) { |
| 7011 | parent.appendChild(node); |
| 7012 | }; |
| 7013 | |
| 7014 | SAXTreeBuilder.prototype.attachNodeToFosterParent = function(child, table, stackParent) { |
| 7015 | var parent = table.parentNode; |
| 7016 | if (parent) |
| 7017 | parent.insertBetween(child, table.previousSibling, table); |
| 7018 | else |
| 7019 | stackParent.appendChild(child); |
| 7020 | }; |
| 7021 | |
| 7022 | SAXTreeBuilder.prototype.detachFromParent = function(element) { |
| 7023 | element.detach(); |
| 7024 | }; |
| 7025 | |
| 7026 | SAXTreeBuilder.prototype.reparentChildren = function(oldParent, newParent) { |
| 7027 | newParent.appendChildren(oldParent.firstChild); |
| 7028 | }; |
| 7029 | |
| 7030 | SAXTreeBuilder.prototype.getFragment = function() { |
| 7031 | var fragment = new DocumentFragment(); |
| 7032 | this.reparentChildren(this.openElements.rootNode, fragment); |
| 7033 | return fragment; |
| 7034 | }; |
| 7035 | |
| 7036 | function getAttribute(node, name) { |
| 7037 | for (var i = 0; i < node.attributes.length; i++) { |
| 7038 | var attribute = node.attributes[i]; |
| 7039 | if (attribute.nodeName === name) |
| 7040 | return attribute.nodeValue; |
| 7041 | } |
| 7042 | } |
| 7043 | |
| 7044 | SAXTreeBuilder.prototype.addAttributesToElement = function(element, attributes) { |
| 7045 | for (var i = 0; i < attributes.length; i++) { |
| 7046 | var attribute = attributes[i]; |
| 7047 | if (!getAttribute(element, attribute.nodeName)) |
| 7048 | element.attributes.push(attribute); |
| 7049 | } |
| 7050 | }; |
| 7051 | |
| 7052 | var NodeType = { |
| 7053 | CDATA: 1, |
| 7054 | CHARACTERS: 2, |
| 7055 | COMMENT: 3, |
| 7056 | DOCUMENT: 4, |
| 7057 | DOCUMENT_FRAGMENT: 5, |
| 7058 | DTD: 6, |
| 7059 | ELEMENT: 7, |
| 7060 | ENTITY: 8, |
| 7061 | IGNORABLE_WHITESPACE: 9, |
| 7062 | PROCESSING_INSTRUCTION: 10, |
| 7063 | SKIPPED_ENTITY: 11 |
| 7064 | }; |
| 7065 | function Node(locator) { |
| 7066 | if (!locator) { |
| 7067 | this.columnNumber = -1; |
| 7068 | this.lineNumber = -1; |
| 7069 | } else { |
| 7070 | this.columnNumber = locator.columnNumber; |
| 7071 | this.lineNumber = locator.lineNumber; |
| 7072 | } |
| 7073 | this.parentNode = null; |
| 7074 | this.nextSibling = null; |
| 7075 | this.firstChild = null; |
| 7076 | } |
| 7077 | Node.prototype.visit = function(treeParser) { |
| 7078 | throw new Error("Not Implemented"); |
| 7079 | }; |
| 7080 | Node.prototype.revisit = function(treeParser) { |
| 7081 | return; |
| 7082 | }; |
| 7083 | Node.prototype.detach = function() { |
| 7084 | if (this.parentNode !== null) { |
| 7085 | this.parentNode.removeChild(this); |
| 7086 | this.parentNode = null; |
| 7087 | } |
| 7088 | }; |
| 7089 | |
| 7090 | Object.defineProperty(Node.prototype, 'previousSibling', { |
| 7091 | get: function() { |
| 7092 | var prev = null; |
| 7093 | var next = this.parentNode.firstChild; |
| 7094 | for(;;) { |
| 7095 | if (this == next) { |
| 7096 | return prev; |
| 7097 | } |
| 7098 | prev = next; |
| 7099 | next = next.nextSibling; |
| 7100 | } |
| 7101 | } |
| 7102 | }); |
| 7103 | |
| 7104 | |
| 7105 | function ParentNode(locator) { |
| 7106 | Node.call(this, locator); |
| 7107 | this.lastChild = null; |
| 7108 | this._endLocator = null; |
| 7109 | } |
| 7110 | |
| 7111 | ParentNode.prototype = Object.create(Node.prototype); |
| 7112 | ParentNode.prototype.insertBefore = function(child, sibling) { |
| 7113 | if (!sibling) { |
| 7114 | return this.appendChild(child); |
| 7115 | } |
| 7116 | child.detach(); |
| 7117 | child.parentNode = this; |
| 7118 | if (this.firstChild == sibling) { |
| 7119 | child.nextSibling = sibling; |
| 7120 | this.firstChild = child; |
| 7121 | } else { |
| 7122 | var prev = this.firstChild; |
| 7123 | var next = this.firstChild.nextSibling; |
| 7124 | while (next != sibling) { |
| 7125 | prev = next; |
| 7126 | next = next.nextSibling; |
| 7127 | } |
| 7128 | prev.nextSibling = child; |
| 7129 | child.nextSibling = next; |
| 7130 | } |
| 7131 | return child; |
| 7132 | }; |
| 7133 | |
| 7134 | ParentNode.prototype.insertBetween = function(child, prev, next) { |
| 7135 | if (!next) { |
| 7136 | return this.appendChild(child); |
| 7137 | } |
| 7138 | child.detach(); |
| 7139 | child.parentNode = this; |
| 7140 | child.nextSibling = next; |
| 7141 | if (!prev) { |
| 7142 | firstChild = child; |
| 7143 | } else { |
| 7144 | prev.nextSibling = child; |
| 7145 | } |
| 7146 | return child; |
| 7147 | }; |
| 7148 | ParentNode.prototype.appendChild = function(child) { |
| 7149 | child.detach(); |
| 7150 | child.parentNode = this; |
| 7151 | if (!this.firstChild) { |
| 7152 | this.firstChild = child; |
| 7153 | } else { |
| 7154 | this.lastChild.nextSibling = child; |
| 7155 | } |
| 7156 | this.lastChild = child; |
| 7157 | return child; |
| 7158 | }; |
| 7159 | ParentNode.prototype.appendChildren = function(parent) { |
| 7160 | var child = parent.firstChild; |
| 7161 | if (!child) { |
| 7162 | return; |
| 7163 | } |
| 7164 | var another = parent; |
| 7165 | if (!this.firstChild) { |
| 7166 | this.firstChild = child; |
| 7167 | } else { |
| 7168 | this.lastChild.nextSibling = child; |
| 7169 | } |
| 7170 | this.lastChild = another.lastChild; |
| 7171 | do { |
| 7172 | child.parentNode = this; |
| 7173 | } while ((child = child.nextSibling)); |
| 7174 | another.firstChild = null; |
| 7175 | another.lastChild = null; |
| 7176 | }; |
| 7177 | ParentNode.prototype.removeChild = function(node) { |
| 7178 | if (this.firstChild == node) { |
| 7179 | this.firstChild = node.nextSibling; |
| 7180 | if (this.lastChild == node) { |
| 7181 | this.lastChild = null; |
| 7182 | } |
| 7183 | } else { |
| 7184 | var prev = this.firstChild; |
| 7185 | var next = this.firstChild.nextSibling; |
| 7186 | while (next != node) { |
| 7187 | prev = next; |
| 7188 | next = next.nextSibling; |
| 7189 | } |
| 7190 | prev.nextSibling = node.nextSibling; |
| 7191 | if (this.lastChild == node) { |
| 7192 | this.lastChild = prev; |
| 7193 | } |
| 7194 | } |
| 7195 | node.parentNode = null; |
| 7196 | return node; |
| 7197 | }; |
| 7198 | |
| 7199 | Object.defineProperty(ParentNode.prototype, 'endLocator', { |
| 7200 | get: function() { |
| 7201 | return this._endLocator; |
| 7202 | }, |
| 7203 | set: function(endLocator) { |
| 7204 | this._endLocator = { |
| 7205 | lineNumber: endLocator.lineNumber, |
| 7206 | columnNumber: endLocator.columnNumber |
| 7207 | }; |
| 7208 | } |
| 7209 | }); |
| 7210 | function Document (locator) { |
| 7211 | ParentNode.call(this, locator); |
| 7212 | this.nodeType = NodeType.DOCUMENT; |
| 7213 | } |
| 7214 | |
| 7215 | Document.prototype = Object.create(ParentNode.prototype); |
| 7216 | Document.prototype.visit = function(treeParser) { |
| 7217 | treeParser.startDocument(this); |
| 7218 | }; |
| 7219 | Document.prototype.revisit = function(treeParser) { |
| 7220 | treeParser.endDocument(this.endLocator); |
| 7221 | }; |
| 7222 | function DocumentFragment() { |
| 7223 | ParentNode.call(this, new Locator()); |
| 7224 | this.nodeType = NodeType.DOCUMENT_FRAGMENT; |
| 7225 | } |
| 7226 | |
| 7227 | DocumentFragment.prototype = Object.create(ParentNode.prototype); |
| 7228 | DocumentFragment.prototype.visit = function(treeParser) { |
| 7229 | }; |
| 7230 | function Element(locator, uri, localName, qName, atts, prefixMappings) { |
| 7231 | ParentNode.call(this, locator); |
| 7232 | this.uri = uri; |
| 7233 | this.localName = localName; |
| 7234 | this.qName = qName; |
| 7235 | this.attributes = atts; |
| 7236 | this.prefixMappings = prefixMappings; |
| 7237 | this.nodeType = NodeType.ELEMENT; |
| 7238 | } |
| 7239 | |
| 7240 | Element.prototype = Object.create(ParentNode.prototype); |
| 7241 | Element.prototype.visit = function(treeParser) { |
| 7242 | if (this.prefixMappings) { |
| 7243 | for (var key in prefixMappings) { |
| 7244 | var mapping = prefixMappings[key]; |
| 7245 | treeParser.startPrefixMapping(mapping.getPrefix(), |
| 7246 | mapping.getUri(), this); |
| 7247 | } |
| 7248 | } |
| 7249 | treeParser.startElement(this.uri, this.localName, this.qName, this.attributes, this); |
| 7250 | }; |
| 7251 | Element.prototype.revisit = function(treeParser) { |
| 7252 | treeParser.endElement(this.uri, this.localName, this.qName, this.endLocator); |
| 7253 | if (this.prefixMappings) { |
| 7254 | for (var key in prefixMappings) { |
| 7255 | var mapping = prefixMappings[key]; |
| 7256 | treeParser.endPrefixMapping(mapping.getPrefix(), this.endLocator); |
| 7257 | } |
| 7258 | } |
| 7259 | }; |
| 7260 | function Characters(locator, data){ |
| 7261 | Node.call(this, locator); |
| 7262 | this.data = data; |
| 7263 | this.nodeType = NodeType.CHARACTERS; |
| 7264 | } |
| 7265 | |
| 7266 | Characters.prototype = Object.create(Node.prototype); |
| 7267 | Characters.prototype.visit = function (treeParser) { |
| 7268 | treeParser.characters(this.data, 0, this.data.length, this); |
| 7269 | }; |
| 7270 | function IgnorableWhitespace(locator, data) { |
| 7271 | Node.call(this, locator); |
| 7272 | this.data = data; |
| 7273 | this.nodeType = NodeType.IGNORABLE_WHITESPACE; |
| 7274 | } |
| 7275 | |
| 7276 | IgnorableWhitespace.prototype = Object.create(Node.prototype); |
| 7277 | IgnorableWhitespace.prototype.visit = function(treeParser) { |
| 7278 | treeParser.ignorableWhitespace(this.data, 0, this.data.length, this); |
| 7279 | }; |
| 7280 | function Comment(locator, data) { |
| 7281 | Node.call(this, locator); |
| 7282 | this.data = data; |
| 7283 | this.nodeType = NodeType.COMMENT; |
| 7284 | } |
| 7285 | |
| 7286 | Comment.prototype = Object.create(Node.prototype); |
| 7287 | Comment.prototype.visit = function(treeParser) { |
| 7288 | treeParser.comment(this.data, 0, this.data.length, this); |
| 7289 | }; |
| 7290 | function CDATA(locator) { |
| 7291 | ParentNode.call(this, locator); |
| 7292 | this.nodeType = NodeType.CDATA; |
| 7293 | } |
| 7294 | |
| 7295 | CDATA.prototype = Object.create(ParentNode.prototype); |
| 7296 | CDATA.prototype.visit = function(treeParser) { |
| 7297 | treeParser.startCDATA(this); |
| 7298 | }; |
| 7299 | CDATA.prototype.revisit = function(treeParser) { |
| 7300 | treeParser.endCDATA(this.endLocator); |
| 7301 | }; |
| 7302 | function Entity(name) { |
| 7303 | ParentNode.call(this); |
| 7304 | this.name = name; |
| 7305 | this.nodeType = NodeType.ENTITY; |
| 7306 | } |
| 7307 | |
| 7308 | Entity.prototype = Object.create(ParentNode.prototype); |
| 7309 | Entity.prototype.visit = function(treeParser) { |
| 7310 | treeParser.startEntity(this.name, this); |
| 7311 | }; |
| 7312 | Entity.prototype.revisit = function(treeParser) { |
| 7313 | treeParser.endEntity(this.name); |
| 7314 | }; |
| 7315 | |
| 7316 | function SkippedEntity(name) { |
| 7317 | Node.call(this); |
| 7318 | this.name = name; |
| 7319 | this.nodeType = NodeType.SKIPPED_ENTITY; |
| 7320 | } |
| 7321 | |
| 7322 | SkippedEntity.prototype = Object.create(Node.prototype); |
| 7323 | SkippedEntity.prototype.visit = function(treeParser) { |
| 7324 | treeParser.skippedEntity(this.name, this); |
| 7325 | }; |
| 7326 | function ProcessingInstruction(target, data) { |
| 7327 | Node.call(this); |
| 7328 | this.target = target; |
| 7329 | this.data = data; |
| 7330 | } |
| 7331 | |
| 7332 | ProcessingInstruction.prototype = Object.create(Node.prototype); |
| 7333 | ProcessingInstruction.prototype.visit = function(treeParser) { |
| 7334 | treeParser.processingInstruction(this.target, this.data, this); |
| 7335 | }; |
| 7336 | ProcessingInstruction.prototype.getNodeType = function() { |
| 7337 | return NodeType.PROCESSING_INSTRUCTION; |
| 7338 | }; |
| 7339 | function DTD(name, publicIdentifier, systemIdentifier) { |
| 7340 | ParentNode.call(this); |
| 7341 | this.name = name; |
| 7342 | this.publicIdentifier = publicIdentifier; |
| 7343 | this.systemIdentifier = systemIdentifier; |
| 7344 | this.nodeType = NodeType.DTD; |
| 7345 | } |
| 7346 | |
| 7347 | DTD.prototype = Object.create(ParentNode.prototype); |
| 7348 | DTD.prototype.visit = function(treeParser) { |
| 7349 | treeParser.startDTD(this.name, this.publicIdentifier, this.systemIdentifier, this); |
| 7350 | }; |
| 7351 | DTD.prototype.revisit = function(treeParser) { |
| 7352 | treeParser.endDTD(); |
| 7353 | }; |
| 7354 | |
| 7355 | exports.SAXTreeBuilder = SAXTreeBuilder; |
| 7356 | |
| 7357 | }, |
| 7358 | {"../TreeBuilder":6,"util":20}], |
| 7359 | 11:[function(_dereq_,module,exports){ |
| 7360 | function TreeParser(contentHandler, lexicalHandler){ |
| 7361 | this.contentHandler; |
| 7362 | this.lexicalHandler; |
| 7363 | this.locatorDelegate; |
| 7364 | |
| 7365 | if (!contentHandler) { |
| 7366 | throw new IllegalArgumentException("contentHandler was null."); |
| 7367 | } |
| 7368 | this.contentHandler = contentHandler; |
| 7369 | if (!lexicalHandler) { |
| 7370 | this.lexicalHandler = new NullLexicalHandler(); |
| 7371 | } else { |
| 7372 | this.lexicalHandler = lexicalHandler; |
| 7373 | } |
| 7374 | } |
| 7375 | TreeParser.prototype.parse = function(node) { |
| 7376 | this.contentHandler.documentLocator = this; |
| 7377 | var current = node; |
| 7378 | var next; |
| 7379 | for (;;) { |
| 7380 | current.visit(this); |
| 7381 | if (next = current.firstChild) { |
| 7382 | current = next; |
| 7383 | continue; |
| 7384 | } |
| 7385 | for (;;) { |
| 7386 | current.revisit(this); |
| 7387 | if (current == node) { |
| 7388 | return; |
| 7389 | } |
| 7390 | if (next = current.nextSibling) { |
| 7391 | current = next; |
| 7392 | break; |
| 7393 | } |
| 7394 | current = current.parentNode; |
| 7395 | } |
| 7396 | } |
| 7397 | }; |
| 7398 | TreeParser.prototype.characters = function(ch, start, length, locator) { |
| 7399 | this.locatorDelegate = locator; |
| 7400 | this.contentHandler.characters(ch, start, length); |
| 7401 | }; |
| 7402 | TreeParser.prototype.endDocument = function(locator) { |
| 7403 | this.locatorDelegate = locator; |
| 7404 | this.contentHandler.endDocument(); |
| 7405 | }; |
| 7406 | TreeParser.prototype.endElement = function(uri, localName, qName, locator) { |
| 7407 | this.locatorDelegate = locator; |
| 7408 | this.contentHandler.endElement(uri, localName, qName); |
| 7409 | }; |
| 7410 | TreeParser.prototype.endPrefixMapping = function(prefix, locator) { |
| 7411 | this.locatorDelegate = locator; |
| 7412 | this.contentHandler.endPrefixMapping(prefix); |
| 7413 | }; |
| 7414 | TreeParser.prototype.ignorableWhitespace = function(ch, start, length, locator) { |
| 7415 | this.locatorDelegate = locator; |
| 7416 | this.contentHandler.ignorableWhitespace(ch, start, length); |
| 7417 | }; |
| 7418 | TreeParser.prototype.processingInstruction = function(target, data, locator) { |
| 7419 | this.locatorDelegate = locator; |
| 7420 | this.contentHandler.processingInstruction(target, data); |
| 7421 | }; |
| 7422 | TreeParser.prototype.skippedEntity = function(name, locator) { |
| 7423 | this.locatorDelegate = locator; |
| 7424 | this.contentHandler.skippedEntity(name); |
| 7425 | }; |
| 7426 | TreeParser.prototype.startDocument = function(locator) { |
| 7427 | this.locatorDelegate = locator; |
| 7428 | this.contentHandler.startDocument(); |
| 7429 | }; |
| 7430 | TreeParser.prototype.startElement = function(uri, localName, qName, atts, locator) { |
| 7431 | this.locatorDelegate = locator; |
| 7432 | this.contentHandler.startElement(uri, localName, qName, atts); |
| 7433 | }; |
| 7434 | TreeParser.prototype.startPrefixMapping = function(prefix, uri, locator) { |
| 7435 | this.locatorDelegate = locator; |
| 7436 | this.contentHandler.startPrefixMapping(prefix, uri); |
| 7437 | }; |
| 7438 | TreeParser.prototype.comment = function(ch, start, length, locator) { |
| 7439 | this.locatorDelegate = locator; |
| 7440 | this.lexicalHandler.comment(ch, start, length); |
| 7441 | }; |
| 7442 | TreeParser.prototype.endCDATA = function(locator) { |
| 7443 | this.locatorDelegate = locator; |
| 7444 | this.lexicalHandler.endCDATA(); |
| 7445 | }; |
| 7446 | TreeParser.prototype.endDTD = function(locator) { |
| 7447 | this.locatorDelegate = locator; |
| 7448 | this.lexicalHandler.endDTD(); |
| 7449 | }; |
| 7450 | TreeParser.prototype.endEntity = function(name, locator) { |
| 7451 | this.locatorDelegate = locator; |
| 7452 | this.lexicalHandler.endEntity(name); |
| 7453 | }; |
| 7454 | TreeParser.prototype.startCDATA = function(locator) { |
| 7455 | this.locatorDelegate = locator; |
| 7456 | this.lexicalHandler.startCDATA(); |
| 7457 | }; |
| 7458 | TreeParser.prototype.startDTD = function(name, publicId, systemId, locator) { |
| 7459 | this.locatorDelegate = locator; |
| 7460 | this.lexicalHandler.startDTD(name, publicId, systemId); |
| 7461 | }; |
| 7462 | TreeParser.prototype.startEntity = function(name, locator) { |
| 7463 | this.locatorDelegate = locator; |
| 7464 | this.lexicalHandler.startEntity(name); |
| 7465 | }; |
| 7466 | |
| 7467 | Object.defineProperty(TreeParser.prototype, 'columnNumber', { |
| 7468 | get: function() { |
| 7469 | if (!this.locatorDelegate) |
| 7470 | return -1; |
| 7471 | else |
| 7472 | return this.locatorDelegate.columnNumber; |
| 7473 | } |
| 7474 | }); |
| 7475 | |
| 7476 | Object.defineProperty(TreeParser.prototype, 'lineNumber', { |
| 7477 | get: function() { |
| 7478 | if (!this.locatorDelegate) |
| 7479 | return -1; |
| 7480 | else |
| 7481 | return this.locatorDelegate.lineNumber; |
| 7482 | } |
| 7483 | }); |
| 7484 | function NullLexicalHandler() { |
| 7485 | |
| 7486 | } |
| 7487 | |
| 7488 | NullLexicalHandler.prototype.comment = function() {}; |
| 7489 | NullLexicalHandler.prototype.endCDATA = function() {}; |
| 7490 | NullLexicalHandler.prototype.endDTD = function() {}; |
| 7491 | NullLexicalHandler.prototype.endEntity = function() {}; |
| 7492 | NullLexicalHandler.prototype.startCDATA = function() {}; |
| 7493 | NullLexicalHandler.prototype.startDTD = function() {}; |
| 7494 | NullLexicalHandler.prototype.startEntity = function() {}; |
| 7495 | |
| 7496 | exports.TreeParser = TreeParser; |
| 7497 | |
| 7498 | }, |
| 7499 | {}], |
| 7500 | 12:[function(_dereq_,module,exports){ |
| 7501 | module.exports = { |
| 7502 | "Aacute;": "\u00C1", |
| 7503 | "Aacute": "\u00C1", |
| 7504 | "aacute;": "\u00E1", |
| 7505 | "aacute": "\u00E1", |
| 7506 | "Abreve;": "\u0102", |
| 7507 | "abreve;": "\u0103", |
| 7508 | "ac;": "\u223E", |
| 7509 | "acd;": "\u223F", |
| 7510 | "acE;": "\u223E\u0333", |
| 7511 | "Acirc;": "\u00C2", |
| 7512 | "Acirc": "\u00C2", |
| 7513 | "acirc;": "\u00E2", |
| 7514 | "acirc": "\u00E2", |
| 7515 | "acute;": "\u00B4", |
| 7516 | "acute": "\u00B4", |
| 7517 | "Acy;": "\u0410", |
| 7518 | "acy;": "\u0430", |
| 7519 | "AElig;": "\u00C6", |
| 7520 | "AElig": "\u00C6", |
| 7521 | "aelig;": "\u00E6", |
| 7522 | "aelig": "\u00E6", |
| 7523 | "af;": "\u2061", |
| 7524 | "Afr;": "\uD835\uDD04", |
| 7525 | "afr;": "\uD835\uDD1E", |
| 7526 | "Agrave;": "\u00C0", |
| 7527 | "Agrave": "\u00C0", |
| 7528 | "agrave;": "\u00E0", |
| 7529 | "agrave": "\u00E0", |
| 7530 | "alefsym;": "\u2135", |
| 7531 | "aleph;": "\u2135", |
| 7532 | "Alpha;": "\u0391", |
| 7533 | "alpha;": "\u03B1", |
| 7534 | "Amacr;": "\u0100", |
| 7535 | "amacr;": "\u0101", |
| 7536 | "amalg;": "\u2A3F", |
| 7537 | "amp;": "\u0026", |
| 7538 | "amp": "\u0026", |
| 7539 | "AMP;": "\u0026", |
| 7540 | "AMP": "\u0026", |
| 7541 | "andand;": "\u2A55", |
| 7542 | "And;": "\u2A53", |
| 7543 | "and;": "\u2227", |
| 7544 | "andd;": "\u2A5C", |
| 7545 | "andslope;": "\u2A58", |
| 7546 | "andv;": "\u2A5A", |
| 7547 | "ang;": "\u2220", |
| 7548 | "ange;": "\u29A4", |
| 7549 | "angle;": "\u2220", |
| 7550 | "angmsdaa;": "\u29A8", |
| 7551 | "angmsdab;": "\u29A9", |
| 7552 | "angmsdac;": "\u29AA", |
| 7553 | "angmsdad;": "\u29AB", |
| 7554 | "angmsdae;": "\u29AC", |
| 7555 | "angmsdaf;": "\u29AD", |
| 7556 | "angmsdag;": "\u29AE", |
| 7557 | "angmsdah;": "\u29AF", |
| 7558 | "angmsd;": "\u2221", |
| 7559 | "angrt;": "\u221F", |
| 7560 | "angrtvb;": "\u22BE", |
| 7561 | "angrtvbd;": "\u299D", |
| 7562 | "angsph;": "\u2222", |
| 7563 | "angst;": "\u00C5", |
| 7564 | "angzarr;": "\u237C", |
| 7565 | "Aogon;": "\u0104", |
| 7566 | "aogon;": "\u0105", |
| 7567 | "Aopf;": "\uD835\uDD38", |
| 7568 | "aopf;": "\uD835\uDD52", |
| 7569 | "apacir;": "\u2A6F", |
| 7570 | "ap;": "\u2248", |
| 7571 | "apE;": "\u2A70", |
| 7572 | "ape;": "\u224A", |
| 7573 | "apid;": "\u224B", |
| 7574 | "apos;": "\u0027", |
| 7575 | "ApplyFunction;": "\u2061", |
| 7576 | "approx;": "\u2248", |
| 7577 | "approxeq;": "\u224A", |
| 7578 | "Aring;": "\u00C5", |
| 7579 | "Aring": "\u00C5", |
| 7580 | "aring;": "\u00E5", |
| 7581 | "aring": "\u00E5", |
| 7582 | "Ascr;": "\uD835\uDC9C", |
| 7583 | "ascr;": "\uD835\uDCB6", |
| 7584 | "Assign;": "\u2254", |
| 7585 | "ast;": "\u002A", |
| 7586 | "asymp;": "\u2248", |
| 7587 | "asympeq;": "\u224D", |
| 7588 | "Atilde;": "\u00C3", |
| 7589 | "Atilde": "\u00C3", |
| 7590 | "atilde;": "\u00E3", |
| 7591 | "atilde": "\u00E3", |
| 7592 | "Auml;": "\u00C4", |
| 7593 | "Auml": "\u00C4", |
| 7594 | "auml;": "\u00E4", |
| 7595 | "auml": "\u00E4", |
| 7596 | "awconint;": "\u2233", |
| 7597 | "awint;": "\u2A11", |
| 7598 | "backcong;": "\u224C", |
| 7599 | "backepsilon;": "\u03F6", |
| 7600 | "backprime;": "\u2035", |
| 7601 | "backsim;": "\u223D", |
| 7602 | "backsimeq;": "\u22CD", |
| 7603 | "Backslash;": "\u2216", |
| 7604 | "Barv;": "\u2AE7", |
| 7605 | "barvee;": "\u22BD", |
| 7606 | "barwed;": "\u2305", |
| 7607 | "Barwed;": "\u2306", |
| 7608 | "barwedge;": "\u2305", |
| 7609 | "bbrk;": "\u23B5", |
| 7610 | "bbrktbrk;": "\u23B6", |
| 7611 | "bcong;": "\u224C", |
| 7612 | "Bcy;": "\u0411", |
| 7613 | "bcy;": "\u0431", |
| 7614 | "bdquo;": "\u201E", |
| 7615 | "becaus;": "\u2235", |
| 7616 | "because;": "\u2235", |
| 7617 | "Because;": "\u2235", |
| 7618 | "bemptyv;": "\u29B0", |
| 7619 | "bepsi;": "\u03F6", |
| 7620 | "bernou;": "\u212C", |
| 7621 | "Bernoullis;": "\u212C", |
| 7622 | "Beta;": "\u0392", |
| 7623 | "beta;": "\u03B2", |
| 7624 | "beth;": "\u2136", |
| 7625 | "between;": "\u226C", |
| 7626 | "Bfr;": "\uD835\uDD05", |
| 7627 | "bfr;": "\uD835\uDD1F", |
| 7628 | "bigcap;": "\u22C2", |
| 7629 | "bigcirc;": "\u25EF", |
| 7630 | "bigcup;": "\u22C3", |
| 7631 | "bigodot;": "\u2A00", |
| 7632 | "bigoplus;": "\u2A01", |
| 7633 | "bigotimes;": "\u2A02", |
| 7634 | "bigsqcup;": "\u2A06", |
| 7635 | "bigstar;": "\u2605", |
| 7636 | "bigtriangledown;": "\u25BD", |
| 7637 | "bigtriangleup;": "\u25B3", |
| 7638 | "biguplus;": "\u2A04", |
| 7639 | "bigvee;": "\u22C1", |
| 7640 | "bigwedge;": "\u22C0", |
| 7641 | "bkarow;": "\u290D", |
| 7642 | "blacklozenge;": "\u29EB", |
| 7643 | "blacksquare;": "\u25AA", |
| 7644 | "blacktriangle;": "\u25B4", |
| 7645 | "blacktriangledown;": "\u25BE", |
| 7646 | "blacktriangleleft;": "\u25C2", |
| 7647 | "blacktriangleright;": "\u25B8", |
| 7648 | "blank;": "\u2423", |
| 7649 | "blk12;": "\u2592", |
| 7650 | "blk14;": "\u2591", |
| 7651 | "blk34;": "\u2593", |
| 7652 | "block;": "\u2588", |
| 7653 | "bne;": "\u003D\u20E5", |
| 7654 | "bnequiv;": "\u2261\u20E5", |
| 7655 | "bNot;": "\u2AED", |
| 7656 | "bnot;": "\u2310", |
| 7657 | "Bopf;": "\uD835\uDD39", |
| 7658 | "bopf;": "\uD835\uDD53", |
| 7659 | "bot;": "\u22A5", |
| 7660 | "bottom;": "\u22A5", |
| 7661 | "bowtie;": "\u22C8", |
| 7662 | "boxbox;": "\u29C9", |
| 7663 | "boxdl;": "\u2510", |
| 7664 | "boxdL;": "\u2555", |
| 7665 | "boxDl;": "\u2556", |
| 7666 | "boxDL;": "\u2557", |
| 7667 | "boxdr;": "\u250C", |
| 7668 | "boxdR;": "\u2552", |
| 7669 | "boxDr;": "\u2553", |
| 7670 | "boxDR;": "\u2554", |
| 7671 | "boxh;": "\u2500", |
| 7672 | "boxH;": "\u2550", |
| 7673 | "boxhd;": "\u252C", |
| 7674 | "boxHd;": "\u2564", |
| 7675 | "boxhD;": "\u2565", |
| 7676 | "boxHD;": "\u2566", |
| 7677 | "boxhu;": "\u2534", |
| 7678 | "boxHu;": "\u2567", |
| 7679 | "boxhU;": "\u2568", |
| 7680 | "boxHU;": "\u2569", |
| 7681 | "boxminus;": "\u229F", |
| 7682 | "boxplus;": "\u229E", |
| 7683 | "boxtimes;": "\u22A0", |
| 7684 | "boxul;": "\u2518", |
| 7685 | "boxuL;": "\u255B", |
| 7686 | "boxUl;": "\u255C", |
| 7687 | "boxUL;": "\u255D", |
| 7688 | "boxur;": "\u2514", |
| 7689 | "boxuR;": "\u2558", |
| 7690 | "boxUr;": "\u2559", |
| 7691 | "boxUR;": "\u255A", |
| 7692 | "boxv;": "\u2502", |
| 7693 | "boxV;": "\u2551", |
| 7694 | "boxvh;": "\u253C", |
| 7695 | "boxvH;": "\u256A", |
| 7696 | "boxVh;": "\u256B", |
| 7697 | "boxVH;": "\u256C", |
| 7698 | "boxvl;": "\u2524", |
| 7699 | "boxvL;": "\u2561", |
| 7700 | "boxVl;": "\u2562", |
| 7701 | "boxVL;": "\u2563", |
| 7702 | "boxvr;": "\u251C", |
| 7703 | "boxvR;": "\u255E", |
| 7704 | "boxVr;": "\u255F", |
| 7705 | "boxVR;": "\u2560", |
| 7706 | "bprime;": "\u2035", |
| 7707 | "breve;": "\u02D8", |
| 7708 | "Breve;": "\u02D8", |
| 7709 | "brvbar;": "\u00A6", |
| 7710 | "brvbar": "\u00A6", |
| 7711 | "bscr;": "\uD835\uDCB7", |
| 7712 | "Bscr;": "\u212C", |
| 7713 | "bsemi;": "\u204F", |
| 7714 | "bsim;": "\u223D", |
| 7715 | "bsime;": "\u22CD", |
| 7716 | "bsolb;": "\u29C5", |
| 7717 | "bsol;": "\u005C", |
| 7718 | "bsolhsub;": "\u27C8", |
| 7719 | "bull;": "\u2022", |
| 7720 | "bullet;": "\u2022", |
| 7721 | "bump;": "\u224E", |
| 7722 | "bumpE;": "\u2AAE", |
| 7723 | "bumpe;": "\u224F", |
| 7724 | "Bumpeq;": "\u224E", |
| 7725 | "bumpeq;": "\u224F", |
| 7726 | "Cacute;": "\u0106", |
| 7727 | "cacute;": "\u0107", |
| 7728 | "capand;": "\u2A44", |
| 7729 | "capbrcup;": "\u2A49", |
| 7730 | "capcap;": "\u2A4B", |
| 7731 | "cap;": "\u2229", |
| 7732 | "Cap;": "\u22D2", |
| 7733 | "capcup;": "\u2A47", |
| 7734 | "capdot;": "\u2A40", |
| 7735 | "CapitalDifferentialD;": "\u2145", |
| 7736 | "caps;": "\u2229\uFE00", |
| 7737 | "caret;": "\u2041", |
| 7738 | "caron;": "\u02C7", |
| 7739 | "Cayleys;": "\u212D", |
| 7740 | "ccaps;": "\u2A4D", |
| 7741 | "Ccaron;": "\u010C", |
| 7742 | "ccaron;": "\u010D", |
| 7743 | "Ccedil;": "\u00C7", |
| 7744 | "Ccedil": "\u00C7", |
| 7745 | "ccedil;": "\u00E7", |
| 7746 | "ccedil": "\u00E7", |
| 7747 | "Ccirc;": "\u0108", |
| 7748 | "ccirc;": "\u0109", |
| 7749 | "Cconint;": "\u2230", |
| 7750 | "ccups;": "\u2A4C", |
| 7751 | "ccupssm;": "\u2A50", |
| 7752 | "Cdot;": "\u010A", |
| 7753 | "cdot;": "\u010B", |
| 7754 | "cedil;": "\u00B8", |
| 7755 | "cedil": "\u00B8", |
| 7756 | "Cedilla;": "\u00B8", |
| 7757 | "cemptyv;": "\u29B2", |
| 7758 | "cent;": "\u00A2", |
| 7759 | "cent": "\u00A2", |
| 7760 | "centerdot;": "\u00B7", |
| 7761 | "CenterDot;": "\u00B7", |
| 7762 | "cfr;": "\uD835\uDD20", |
| 7763 | "Cfr;": "\u212D", |
| 7764 | "CHcy;": "\u0427", |
| 7765 | "chcy;": "\u0447", |
| 7766 | "check;": "\u2713", |
| 7767 | "checkmark;": "\u2713", |
| 7768 | "Chi;": "\u03A7", |
| 7769 | "chi;": "\u03C7", |
| 7770 | "circ;": "\u02C6", |
| 7771 | "circeq;": "\u2257", |
| 7772 | "circlearrowleft;": "\u21BA", |
| 7773 | "circlearrowright;": "\u21BB", |
| 7774 | "circledast;": "\u229B", |
| 7775 | "circledcirc;": "\u229A", |
| 7776 | "circleddash;": "\u229D", |
| 7777 | "CircleDot;": "\u2299", |
| 7778 | "circledR;": "\u00AE", |
| 7779 | "circledS;": "\u24C8", |
| 7780 | "CircleMinus;": "\u2296", |
| 7781 | "CirclePlus;": "\u2295", |
| 7782 | "CircleTimes;": "\u2297", |
| 7783 | "cir;": "\u25CB", |
| 7784 | "cirE;": "\u29C3", |
| 7785 | "cire;": "\u2257", |
| 7786 | "cirfnint;": "\u2A10", |
| 7787 | "cirmid;": "\u2AEF", |
| 7788 | "cirscir;": "\u29C2", |
| 7789 | "ClockwiseContourIntegral;": "\u2232", |
| 7790 | "CloseCurlyDoubleQuote;": "\u201D", |
| 7791 | "CloseCurlyQuote;": "\u2019", |
| 7792 | "clubs;": "\u2663", |
| 7793 | "clubsuit;": "\u2663", |
| 7794 | "colon;": "\u003A", |
| 7795 | "Colon;": "\u2237", |
| 7796 | "Colone;": "\u2A74", |
| 7797 | "colone;": "\u2254", |
| 7798 | "coloneq;": "\u2254", |
| 7799 | "comma;": "\u002C", |
| 7800 | "commat;": "\u0040", |
| 7801 | "comp;": "\u2201", |
| 7802 | "compfn;": "\u2218", |
| 7803 | "complement;": "\u2201", |
| 7804 | "complexes;": "\u2102", |
| 7805 | "cong;": "\u2245", |
| 7806 | "congdot;": "\u2A6D", |
| 7807 | "Congruent;": "\u2261", |
| 7808 | "conint;": "\u222E", |
| 7809 | "Conint;": "\u222F", |
| 7810 | "ContourIntegral;": "\u222E", |
| 7811 | "copf;": "\uD835\uDD54", |
| 7812 | "Copf;": "\u2102", |
| 7813 | "coprod;": "\u2210", |
| 7814 | "Coproduct;": "\u2210", |
| 7815 | "copy;": "\u00A9", |
| 7816 | "copy": "\u00A9", |
| 7817 | "COPY;": "\u00A9", |
| 7818 | "COPY": "\u00A9", |
| 7819 | "copysr;": "\u2117", |
| 7820 | "CounterClockwiseContourIntegral;": "\u2233", |
| 7821 | "crarr;": "\u21B5", |
| 7822 | "cross;": "\u2717", |
| 7823 | "Cross;": "\u2A2F", |
| 7824 | "Cscr;": "\uD835\uDC9E", |
| 7825 | "cscr;": "\uD835\uDCB8", |
| 7826 | "csub;": "\u2ACF", |
| 7827 | "csube;": "\u2AD1", |
| 7828 | "csup;": "\u2AD0", |
| 7829 | "csupe;": "\u2AD2", |
| 7830 | "ctdot;": "\u22EF", |
| 7831 | "cudarrl;": "\u2938", |
| 7832 | "cudarrr;": "\u2935", |
| 7833 | "cuepr;": "\u22DE", |
| 7834 | "cuesc;": "\u22DF", |
| 7835 | "cularr;": "\u21B6", |
| 7836 | "cularrp;": "\u293D", |
| 7837 | "cupbrcap;": "\u2A48", |
| 7838 | "cupcap;": "\u2A46", |
| 7839 | "CupCap;": "\u224D", |
| 7840 | "cup;": "\u222A", |
| 7841 | "Cup;": "\u22D3", |
| 7842 | "cupcup;": "\u2A4A", |
| 7843 | "cupdot;": "\u228D", |
| 7844 | "cupor;": "\u2A45", |
| 7845 | "cups;": "\u222A\uFE00", |
| 7846 | "curarr;": "\u21B7", |
| 7847 | "curarrm;": "\u293C", |
| 7848 | "curlyeqprec;": "\u22DE", |
| 7849 | "curlyeqsucc;": "\u22DF", |
| 7850 | "curlyvee;": "\u22CE", |
| 7851 | "curlywedge;": "\u22CF", |
| 7852 | "curren;": "\u00A4", |
| 7853 | "curren": "\u00A4", |
| 7854 | "curvearrowleft;": "\u21B6", |
| 7855 | "curvearrowright;": "\u21B7", |
| 7856 | "cuvee;": "\u22CE", |
| 7857 | "cuwed;": "\u22CF", |
| 7858 | "cwconint;": "\u2232", |
| 7859 | "cwint;": "\u2231", |
| 7860 | "cylcty;": "\u232D", |
| 7861 | "dagger;": "\u2020", |
| 7862 | "Dagger;": "\u2021", |
| 7863 | "daleth;": "\u2138", |
| 7864 | "darr;": "\u2193", |
| 7865 | "Darr;": "\u21A1", |
| 7866 | "dArr;": "\u21D3", |
| 7867 | "dash;": "\u2010", |
| 7868 | "Dashv;": "\u2AE4", |
| 7869 | "dashv;": "\u22A3", |
| 7870 | "dbkarow;": "\u290F", |
| 7871 | "dblac;": "\u02DD", |
| 7872 | "Dcaron;": "\u010E", |
| 7873 | "dcaron;": "\u010F", |
| 7874 | "Dcy;": "\u0414", |
| 7875 | "dcy;": "\u0434", |
| 7876 | "ddagger;": "\u2021", |
| 7877 | "ddarr;": "\u21CA", |
| 7878 | "DD;": "\u2145", |
| 7879 | "dd;": "\u2146", |
| 7880 | "DDotrahd;": "\u2911", |
| 7881 | "ddotseq;": "\u2A77", |
| 7882 | "deg;": "\u00B0", |
| 7883 | "deg": "\u00B0", |
| 7884 | "Del;": "\u2207", |
| 7885 | "Delta;": "\u0394", |
| 7886 | "delta;": "\u03B4", |
| 7887 | "demptyv;": "\u29B1", |
| 7888 | "dfisht;": "\u297F", |
| 7889 | "Dfr;": "\uD835\uDD07", |
| 7890 | "dfr;": "\uD835\uDD21", |
| 7891 | "dHar;": "\u2965", |
| 7892 | "dharl;": "\u21C3", |
| 7893 | "dharr;": "\u21C2", |
| 7894 | "DiacriticalAcute;": "\u00B4", |
| 7895 | "DiacriticalDot;": "\u02D9", |
| 7896 | "DiacriticalDoubleAcute;": "\u02DD", |
| 7897 | "DiacriticalGrave;": "\u0060", |
| 7898 | "DiacriticalTilde;": "\u02DC", |
| 7899 | "diam;": "\u22C4", |
| 7900 | "diamond;": "\u22C4", |
| 7901 | "Diamond;": "\u22C4", |
| 7902 | "diamondsuit;": "\u2666", |
| 7903 | "diams;": "\u2666", |
| 7904 | "die;": "\u00A8", |
| 7905 | "DifferentialD;": "\u2146", |
| 7906 | "digamma;": "\u03DD", |
| 7907 | "disin;": "\u22F2", |
| 7908 | "div;": "\u00F7", |
| 7909 | "divide;": "\u00F7", |
| 7910 | "divide": "\u00F7", |
| 7911 | "divideontimes;": "\u22C7", |
| 7912 | "divonx;": "\u22C7", |
| 7913 | "DJcy;": "\u0402", |
| 7914 | "djcy;": "\u0452", |
| 7915 | "dlcorn;": "\u231E", |
| 7916 | "dlcrop;": "\u230D", |
| 7917 | "dollar;": "\u0024", |
| 7918 | "Dopf;": "\uD835\uDD3B", |
| 7919 | "dopf;": "\uD835\uDD55", |
| 7920 | "Dot;": "\u00A8", |
| 7921 | "dot;": "\u02D9", |
| 7922 | "DotDot;": "\u20DC", |
| 7923 | "doteq;": "\u2250", |
| 7924 | "doteqdot;": "\u2251", |
| 7925 | "DotEqual;": "\u2250", |
| 7926 | "dotminus;": "\u2238", |
| 7927 | "dotplus;": "\u2214", |
| 7928 | "dotsquare;": "\u22A1", |
| 7929 | "doublebarwedge;": "\u2306", |
| 7930 | "DoubleContourIntegral;": "\u222F", |
| 7931 | "DoubleDot;": "\u00A8", |
| 7932 | "DoubleDownArrow;": "\u21D3", |
| 7933 | "DoubleLeftArrow;": "\u21D0", |
| 7934 | "DoubleLeftRightArrow;": "\u21D4", |
| 7935 | "DoubleLeftTee;": "\u2AE4", |
| 7936 | "DoubleLongLeftArrow;": "\u27F8", |
| 7937 | "DoubleLongLeftRightArrow;": "\u27FA", |
| 7938 | "DoubleLongRightArrow;": "\u27F9", |
| 7939 | "DoubleRightArrow;": "\u21D2", |
| 7940 | "DoubleRightTee;": "\u22A8", |
| 7941 | "DoubleUpArrow;": "\u21D1", |
| 7942 | "DoubleUpDownArrow;": "\u21D5", |
| 7943 | "DoubleVerticalBar;": "\u2225", |
| 7944 | "DownArrowBar;": "\u2913", |
| 7945 | "downarrow;": "\u2193", |
| 7946 | "DownArrow;": "\u2193", |
| 7947 | "Downarrow;": "\u21D3", |
| 7948 | "DownArrowUpArrow;": "\u21F5", |
| 7949 | "DownBreve;": "\u0311", |
| 7950 | "downdownarrows;": "\u21CA", |
| 7951 | "downharpoonleft;": "\u21C3", |
| 7952 | "downharpoonright;": "\u21C2", |
| 7953 | "DownLeftRightVector;": "\u2950", |
| 7954 | "DownLeftTeeVector;": "\u295E", |
| 7955 | "DownLeftVectorBar;": "\u2956", |
| 7956 | "DownLeftVector;": "\u21BD", |
| 7957 | "DownRightTeeVector;": "\u295F", |
| 7958 | "DownRightVectorBar;": "\u2957", |
| 7959 | "DownRightVector;": "\u21C1", |
| 7960 | "DownTeeArrow;": "\u21A7", |
| 7961 | "DownTee;": "\u22A4", |
| 7962 | "drbkarow;": "\u2910", |
| 7963 | "drcorn;": "\u231F", |
| 7964 | "drcrop;": "\u230C", |
| 7965 | "Dscr;": "\uD835\uDC9F", |
| 7966 | "dscr;": "\uD835\uDCB9", |
| 7967 | "DScy;": "\u0405", |
| 7968 | "dscy;": "\u0455", |
| 7969 | "dsol;": "\u29F6", |
| 7970 | "Dstrok;": "\u0110", |
| 7971 | "dstrok;": "\u0111", |
| 7972 | "dtdot;": "\u22F1", |
| 7973 | "dtri;": "\u25BF", |
| 7974 | "dtrif;": "\u25BE", |
| 7975 | "duarr;": "\u21F5", |
| 7976 | "duhar;": "\u296F", |
| 7977 | "dwangle;": "\u29A6", |
| 7978 | "DZcy;": "\u040F", |
| 7979 | "dzcy;": "\u045F", |
| 7980 | "dzigrarr;": "\u27FF", |
| 7981 | "Eacute;": "\u00C9", |
| 7982 | "Eacute": "\u00C9", |
| 7983 | "eacute;": "\u00E9", |
| 7984 | "eacute": "\u00E9", |
| 7985 | "easter;": "\u2A6E", |
| 7986 | "Ecaron;": "\u011A", |
| 7987 | "ecaron;": "\u011B", |
| 7988 | "Ecirc;": "\u00CA", |
| 7989 | "Ecirc": "\u00CA", |
| 7990 | "ecirc;": "\u00EA", |
| 7991 | "ecirc": "\u00EA", |
| 7992 | "ecir;": "\u2256", |
| 7993 | "ecolon;": "\u2255", |
| 7994 | "Ecy;": "\u042D", |
| 7995 | "ecy;": "\u044D", |
| 7996 | "eDDot;": "\u2A77", |
| 7997 | "Edot;": "\u0116", |
| 7998 | "edot;": "\u0117", |
| 7999 | "eDot;": "\u2251", |
| 8000 | "ee;": "\u2147", |
| 8001 | "efDot;": "\u2252", |
| 8002 | "Efr;": "\uD835\uDD08", |
| 8003 | "efr;": "\uD835\uDD22", |
| 8004 | "eg;": "\u2A9A", |
| 8005 | "Egrave;": "\u00C8", |
| 8006 | "Egrave": "\u00C8", |
| 8007 | "egrave;": "\u00E8", |
| 8008 | "egrave": "\u00E8", |
| 8009 | "egs;": "\u2A96", |
| 8010 | "egsdot;": "\u2A98", |
| 8011 | "el;": "\u2A99", |
| 8012 | "Element;": "\u2208", |
| 8013 | "elinters;": "\u23E7", |
| 8014 | "ell;": "\u2113", |
| 8015 | "els;": "\u2A95", |
| 8016 | "elsdot;": "\u2A97", |
| 8017 | "Emacr;": "\u0112", |
| 8018 | "emacr;": "\u0113", |
| 8019 | "empty;": "\u2205", |
| 8020 | "emptyset;": "\u2205", |
| 8021 | "EmptySmallSquare;": "\u25FB", |
| 8022 | "emptyv;": "\u2205", |
| 8023 | "EmptyVerySmallSquare;": "\u25AB", |
| 8024 | "emsp13;": "\u2004", |
| 8025 | "emsp14;": "\u2005", |
| 8026 | "emsp;": "\u2003", |
| 8027 | "ENG;": "\u014A", |
| 8028 | "eng;": "\u014B", |
| 8029 | "ensp;": "\u2002", |
| 8030 | "Eogon;": "\u0118", |
| 8031 | "eogon;": "\u0119", |
| 8032 | "Eopf;": "\uD835\uDD3C", |
| 8033 | "eopf;": "\uD835\uDD56", |
| 8034 | "epar;": "\u22D5", |
| 8035 | "eparsl;": "\u29E3", |
| 8036 | "eplus;": "\u2A71", |
| 8037 | "epsi;": "\u03B5", |
| 8038 | "Epsilon;": "\u0395", |
| 8039 | "epsilon;": "\u03B5", |
| 8040 | "epsiv;": "\u03F5", |
| 8041 | "eqcirc;": "\u2256", |
| 8042 | "eqcolon;": "\u2255", |
| 8043 | "eqsim;": "\u2242", |
| 8044 | "eqslantgtr;": "\u2A96", |
| 8045 | "eqslantless;": "\u2A95", |
| 8046 | "Equal;": "\u2A75", |
| 8047 | "equals;": "\u003D", |
| 8048 | "EqualTilde;": "\u2242", |
| 8049 | "equest;": "\u225F", |
| 8050 | "Equilibrium;": "\u21CC", |
| 8051 | "equiv;": "\u2261", |
| 8052 | "equivDD;": "\u2A78", |
| 8053 | "eqvparsl;": "\u29E5", |
| 8054 | "erarr;": "\u2971", |
| 8055 | "erDot;": "\u2253", |
| 8056 | "escr;": "\u212F", |
| 8057 | "Escr;": "\u2130", |
| 8058 | "esdot;": "\u2250", |
| 8059 | "Esim;": "\u2A73", |
| 8060 | "esim;": "\u2242", |
| 8061 | "Eta;": "\u0397", |
| 8062 | "eta;": "\u03B7", |
| 8063 | "ETH;": "\u00D0", |
| 8064 | "ETH": "\u00D0", |
| 8065 | "eth;": "\u00F0", |
| 8066 | "eth": "\u00F0", |
| 8067 | "Euml;": "\u00CB", |
| 8068 | "Euml": "\u00CB", |
| 8069 | "euml;": "\u00EB", |
| 8070 | "euml": "\u00EB", |
| 8071 | "euro;": "\u20AC", |
| 8072 | "excl;": "\u0021", |
| 8073 | "exist;": "\u2203", |
| 8074 | "Exists;": "\u2203", |
| 8075 | "expectation;": "\u2130", |
| 8076 | "exponentiale;": "\u2147", |
| 8077 | "ExponentialE;": "\u2147", |
| 8078 | "fallingdotseq;": "\u2252", |
| 8079 | "Fcy;": "\u0424", |
| 8080 | "fcy;": "\u0444", |
| 8081 | "female;": "\u2640", |
| 8082 | "ffilig;": "\uFB03", |
| 8083 | "fflig;": "\uFB00", |
| 8084 | "ffllig;": "\uFB04", |
| 8085 | "Ffr;": "\uD835\uDD09", |
| 8086 | "ffr;": "\uD835\uDD23", |
| 8087 | "filig;": "\uFB01", |
| 8088 | "FilledSmallSquare;": "\u25FC", |
| 8089 | "FilledVerySmallSquare;": "\u25AA", |
| 8090 | "fjlig;": "\u0066\u006A", |
| 8091 | "flat;": "\u266D", |
| 8092 | "fllig;": "\uFB02", |
| 8093 | "fltns;": "\u25B1", |
| 8094 | "fnof;": "\u0192", |
| 8095 | "Fopf;": "\uD835\uDD3D", |
| 8096 | "fopf;": "\uD835\uDD57", |
| 8097 | "forall;": "\u2200", |
| 8098 | "ForAll;": "\u2200", |
| 8099 | "fork;": "\u22D4", |
| 8100 | "forkv;": "\u2AD9", |
| 8101 | "Fouriertrf;": "\u2131", |
| 8102 | "fpartint;": "\u2A0D", |
| 8103 | "frac12;": "\u00BD", |
| 8104 | "frac12": "\u00BD", |
| 8105 | "frac13;": "\u2153", |
| 8106 | "frac14;": "\u00BC", |
| 8107 | "frac14": "\u00BC", |
| 8108 | "frac15;": "\u2155", |
| 8109 | "frac16;": "\u2159", |
| 8110 | "frac18;": "\u215B", |
| 8111 | "frac23;": "\u2154", |
| 8112 | "frac25;": "\u2156", |
| 8113 | "frac34;": "\u00BE", |
| 8114 | "frac34": "\u00BE", |
| 8115 | "frac35;": "\u2157", |
| 8116 | "frac38;": "\u215C", |
| 8117 | "frac45;": "\u2158", |
| 8118 | "frac56;": "\u215A", |
| 8119 | "frac58;": "\u215D", |
| 8120 | "frac78;": "\u215E", |
| 8121 | "frasl;": "\u2044", |
| 8122 | "frown;": "\u2322", |
| 8123 | "fscr;": "\uD835\uDCBB", |
| 8124 | "Fscr;": "\u2131", |
| 8125 | "gacute;": "\u01F5", |
| 8126 | "Gamma;": "\u0393", |
| 8127 | "gamma;": "\u03B3", |
| 8128 | "Gammad;": "\u03DC", |
| 8129 | "gammad;": "\u03DD", |
| 8130 | "gap;": "\u2A86", |
| 8131 | "Gbreve;": "\u011E", |
| 8132 | "gbreve;": "\u011F", |
| 8133 | "Gcedil;": "\u0122", |
| 8134 | "Gcirc;": "\u011C", |
| 8135 | "gcirc;": "\u011D", |
| 8136 | "Gcy;": "\u0413", |
| 8137 | "gcy;": "\u0433", |
| 8138 | "Gdot;": "\u0120", |
| 8139 | "gdot;": "\u0121", |
| 8140 | "ge;": "\u2265", |
| 8141 | "gE;": "\u2267", |
| 8142 | "gEl;": "\u2A8C", |
| 8143 | "gel;": "\u22DB", |
| 8144 | "geq;": "\u2265", |
| 8145 | "geqq;": "\u2267", |
| 8146 | "geqslant;": "\u2A7E", |
| 8147 | "gescc;": "\u2AA9", |
| 8148 | "ges;": "\u2A7E", |
| 8149 | "gesdot;": "\u2A80", |
| 8150 | "gesdoto;": "\u2A82", |
| 8151 | "gesdotol;": "\u2A84", |
| 8152 | "gesl;": "\u22DB\uFE00", |
| 8153 | "gesles;": "\u2A94", |
| 8154 | "Gfr;": "\uD835\uDD0A", |
| 8155 | "gfr;": "\uD835\uDD24", |
| 8156 | "gg;": "\u226B", |
| 8157 | "Gg;": "\u22D9", |
| 8158 | "ggg;": "\u22D9", |
| 8159 | "gimel;": "\u2137", |
| 8160 | "GJcy;": "\u0403", |
| 8161 | "gjcy;": "\u0453", |
| 8162 | "gla;": "\u2AA5", |
| 8163 | "gl;": "\u2277", |
| 8164 | "glE;": "\u2A92", |
| 8165 | "glj;": "\u2AA4", |
| 8166 | "gnap;": "\u2A8A", |
| 8167 | "gnapprox;": "\u2A8A", |
| 8168 | "gne;": "\u2A88", |
| 8169 | "gnE;": "\u2269", |
| 8170 | "gneq;": "\u2A88", |
| 8171 | "gneqq;": "\u2269", |
| 8172 | "gnsim;": "\u22E7", |
| 8173 | "Gopf;": "\uD835\uDD3E", |
| 8174 | "gopf;": "\uD835\uDD58", |
| 8175 | "grave;": "\u0060", |
| 8176 | "GreaterEqual;": "\u2265", |
| 8177 | "GreaterEqualLess;": "\u22DB", |
| 8178 | "GreaterFullEqual;": "\u2267", |
| 8179 | "GreaterGreater;": "\u2AA2", |
| 8180 | "GreaterLess;": "\u2277", |
| 8181 | "GreaterSlantEqual;": "\u2A7E", |
| 8182 | "GreaterTilde;": "\u2273", |
| 8183 | "Gscr;": "\uD835\uDCA2", |
| 8184 | "gscr;": "\u210A", |
| 8185 | "gsim;": "\u2273", |
| 8186 | "gsime;": "\u2A8E", |
| 8187 | "gsiml;": "\u2A90", |
| 8188 | "gtcc;": "\u2AA7", |
| 8189 | "gtcir;": "\u2A7A", |
| 8190 | "gt;": "\u003E", |
| 8191 | "gt": "\u003E", |
| 8192 | "GT;": "\u003E", |
| 8193 | "GT": "\u003E", |
| 8194 | "Gt;": "\u226B", |
| 8195 | "gtdot;": "\u22D7", |
| 8196 | "gtlPar;": "\u2995", |
| 8197 | "gtquest;": "\u2A7C", |
| 8198 | "gtrapprox;": "\u2A86", |
| 8199 | "gtrarr;": "\u2978", |
| 8200 | "gtrdot;": "\u22D7", |
| 8201 | "gtreqless;": "\u22DB", |
| 8202 | "gtreqqless;": "\u2A8C", |
| 8203 | "gtrless;": "\u2277", |
| 8204 | "gtrsim;": "\u2273", |
| 8205 | "gvertneqq;": "\u2269\uFE00", |
| 8206 | "gvnE;": "\u2269\uFE00", |
| 8207 | "Hacek;": "\u02C7", |
| 8208 | "hairsp;": "\u200A", |
| 8209 | "half;": "\u00BD", |
| 8210 | "hamilt;": "\u210B", |
| 8211 | "HARDcy;": "\u042A", |
| 8212 | "hardcy;": "\u044A", |
| 8213 | "harrcir;": "\u2948", |
| 8214 | "harr;": "\u2194", |
| 8215 | "hArr;": "\u21D4", |
| 8216 | "harrw;": "\u21AD", |
| 8217 | "Hat;": "\u005E", |
| 8218 | "hbar;": "\u210F", |
| 8219 | "Hcirc;": "\u0124", |
| 8220 | "hcirc;": "\u0125", |
| 8221 | "hearts;": "\u2665", |
| 8222 | "heartsuit;": "\u2665", |
| 8223 | "hellip;": "\u2026", |
| 8224 | "hercon;": "\u22B9", |
| 8225 | "hfr;": "\uD835\uDD25", |
| 8226 | "Hfr;": "\u210C", |
| 8227 | "HilbertSpace;": "\u210B", |
| 8228 | "hksearow;": "\u2925", |
| 8229 | "hkswarow;": "\u2926", |
| 8230 | "hoarr;": "\u21FF", |
| 8231 | "homtht;": "\u223B", |
| 8232 | "hookleftarrow;": "\u21A9", |
| 8233 | "hookrightarrow;": "\u21AA", |
| 8234 | "hopf;": "\uD835\uDD59", |
| 8235 | "Hopf;": "\u210D", |
| 8236 | "horbar;": "\u2015", |
| 8237 | "HorizontalLine;": "\u2500", |
| 8238 | "hscr;": "\uD835\uDCBD", |
| 8239 | "Hscr;": "\u210B", |
| 8240 | "hslash;": "\u210F", |
| 8241 | "Hstrok;": "\u0126", |
| 8242 | "hstrok;": "\u0127", |
| 8243 | "HumpDownHump;": "\u224E", |
| 8244 | "HumpEqual;": "\u224F", |
| 8245 | "hybull;": "\u2043", |
| 8246 | "hyphen;": "\u2010", |
| 8247 | "Iacute;": "\u00CD", |
| 8248 | "Iacute": "\u00CD", |
| 8249 | "iacute;": "\u00ED", |
| 8250 | "iacute": "\u00ED", |
| 8251 | "ic;": "\u2063", |
| 8252 | "Icirc;": "\u00CE", |
| 8253 | "Icirc": "\u00CE", |
| 8254 | "icirc;": "\u00EE", |
| 8255 | "icirc": "\u00EE", |
| 8256 | "Icy;": "\u0418", |
| 8257 | "icy;": "\u0438", |
| 8258 | "Idot;": "\u0130", |
| 8259 | "IEcy;": "\u0415", |
| 8260 | "iecy;": "\u0435", |
| 8261 | "iexcl;": "\u00A1", |
| 8262 | "iexcl": "\u00A1", |
| 8263 | "iff;": "\u21D4", |
| 8264 | "ifr;": "\uD835\uDD26", |
| 8265 | "Ifr;": "\u2111", |
| 8266 | "Igrave;": "\u00CC", |
| 8267 | "Igrave": "\u00CC", |
| 8268 | "igrave;": "\u00EC", |
| 8269 | "igrave": "\u00EC", |
| 8270 | "ii;": "\u2148", |
| 8271 | "iiiint;": "\u2A0C", |
| 8272 | "iiint;": "\u222D", |
| 8273 | "iinfin;": "\u29DC", |
| 8274 | "iiota;": "\u2129", |
| 8275 | "IJlig;": "\u0132", |
| 8276 | "ijlig;": "\u0133", |
| 8277 | "Imacr;": "\u012A", |
| 8278 | "imacr;": "\u012B", |
| 8279 | "image;": "\u2111", |
| 8280 | "ImaginaryI;": "\u2148", |
| 8281 | "imagline;": "\u2110", |
| 8282 | "imagpart;": "\u2111", |
| 8283 | "imath;": "\u0131", |
| 8284 | "Im;": "\u2111", |
| 8285 | "imof;": "\u22B7", |
| 8286 | "imped;": "\u01B5", |
| 8287 | "Implies;": "\u21D2", |
| 8288 | "incare;": "\u2105", |
| 8289 | "in;": "\u2208", |
| 8290 | "infin;": "\u221E", |
| 8291 | "infintie;": "\u29DD", |
| 8292 | "inodot;": "\u0131", |
| 8293 | "intcal;": "\u22BA", |
| 8294 | "int;": "\u222B", |
| 8295 | "Int;": "\u222C", |
| 8296 | "integers;": "\u2124", |
| 8297 | "Integral;": "\u222B", |
| 8298 | "intercal;": "\u22BA", |
| 8299 | "Intersection;": "\u22C2", |
| 8300 | "intlarhk;": "\u2A17", |
| 8301 | "intprod;": "\u2A3C", |
| 8302 | "InvisibleComma;": "\u2063", |
| 8303 | "InvisibleTimes;": "\u2062", |
| 8304 | "IOcy;": "\u0401", |
| 8305 | "iocy;": "\u0451", |
| 8306 | "Iogon;": "\u012E", |
| 8307 | "iogon;": "\u012F", |
| 8308 | "Iopf;": "\uD835\uDD40", |
| 8309 | "iopf;": "\uD835\uDD5A", |
| 8310 | "Iota;": "\u0399", |
| 8311 | "iota;": "\u03B9", |
| 8312 | "iprod;": "\u2A3C", |
| 8313 | "iquest;": "\u00BF", |
| 8314 | "iquest": "\u00BF", |
| 8315 | "iscr;": "\uD835\uDCBE", |
| 8316 | "Iscr;": "\u2110", |
| 8317 | "isin;": "\u2208", |
| 8318 | "isindot;": "\u22F5", |
| 8319 | "isinE;": "\u22F9", |
| 8320 | "isins;": "\u22F4", |
| 8321 | "isinsv;": "\u22F3", |
| 8322 | "isinv;": "\u2208", |
| 8323 | "it;": "\u2062", |
| 8324 | "Itilde;": "\u0128", |
| 8325 | "itilde;": "\u0129", |
| 8326 | "Iukcy;": "\u0406", |
| 8327 | "iukcy;": "\u0456", |
| 8328 | "Iuml;": "\u00CF", |
| 8329 | "Iuml": "\u00CF", |
| 8330 | "iuml;": "\u00EF", |
| 8331 | "iuml": "\u00EF", |
| 8332 | "Jcirc;": "\u0134", |
| 8333 | "jcirc;": "\u0135", |
| 8334 | "Jcy;": "\u0419", |
| 8335 | "jcy;": "\u0439", |
| 8336 | "Jfr;": "\uD835\uDD0D", |
| 8337 | "jfr;": "\uD835\uDD27", |
| 8338 | "jmath;": "\u0237", |
| 8339 | "Jopf;": "\uD835\uDD41", |
| 8340 | "jopf;": "\uD835\uDD5B", |
| 8341 | "Jscr;": "\uD835\uDCA5", |
| 8342 | "jscr;": "\uD835\uDCBF", |
| 8343 | "Jsercy;": "\u0408", |
| 8344 | "jsercy;": "\u0458", |
| 8345 | "Jukcy;": "\u0404", |
| 8346 | "jukcy;": "\u0454", |
| 8347 | "Kappa;": "\u039A", |
| 8348 | "kappa;": "\u03BA", |
| 8349 | "kappav;": "\u03F0", |
| 8350 | "Kcedil;": "\u0136", |
| 8351 | "kcedil;": "\u0137", |
| 8352 | "Kcy;": "\u041A", |
| 8353 | "kcy;": "\u043A", |
| 8354 | "Kfr;": "\uD835\uDD0E", |
| 8355 | "kfr;": "\uD835\uDD28", |
| 8356 | "kgreen;": "\u0138", |
| 8357 | "KHcy;": "\u0425", |
| 8358 | "khcy;": "\u0445", |
| 8359 | "KJcy;": "\u040C", |
| 8360 | "kjcy;": "\u045C", |
| 8361 | "Kopf;": "\uD835\uDD42", |
| 8362 | "kopf;": "\uD835\uDD5C", |
| 8363 | "Kscr;": "\uD835\uDCA6", |
| 8364 | "kscr;": "\uD835\uDCC0", |
| 8365 | "lAarr;": "\u21DA", |
| 8366 | "Lacute;": "\u0139", |
| 8367 | "lacute;": "\u013A", |
| 8368 | "laemptyv;": "\u29B4", |
| 8369 | "lagran;": "\u2112", |
| 8370 | "Lambda;": "\u039B", |
| 8371 | "lambda;": "\u03BB", |
| 8372 | "lang;": "\u27E8", |
| 8373 | "Lang;": "\u27EA", |
| 8374 | "langd;": "\u2991", |
| 8375 | "langle;": "\u27E8", |
| 8376 | "lap;": "\u2A85", |
| 8377 | "Laplacetrf;": "\u2112", |
| 8378 | "laquo;": "\u00AB", |
| 8379 | "laquo": "\u00AB", |
| 8380 | "larrb;": "\u21E4", |
| 8381 | "larrbfs;": "\u291F", |
| 8382 | "larr;": "\u2190", |
| 8383 | "Larr;": "\u219E", |
| 8384 | "lArr;": "\u21D0", |
| 8385 | "larrfs;": "\u291D", |
| 8386 | "larrhk;": "\u21A9", |
| 8387 | "larrlp;": "\u21AB", |
| 8388 | "larrpl;": "\u2939", |
| 8389 | "larrsim;": "\u2973", |
| 8390 | "larrtl;": "\u21A2", |
| 8391 | "latail;": "\u2919", |
| 8392 | "lAtail;": "\u291B", |
| 8393 | "lat;": "\u2AAB", |
| 8394 | "late;": "\u2AAD", |
| 8395 | "lates;": "\u2AAD\uFE00", |
| 8396 | "lbarr;": "\u290C", |
| 8397 | "lBarr;": "\u290E", |
| 8398 | "lbbrk;": "\u2772", |
| 8399 | "lbrace;": "\u007B", |
| 8400 | "lbrack;": "\u005B", |
| 8401 | "lbrke;": "\u298B", |
| 8402 | "lbrksld;": "\u298F", |
| 8403 | "lbrkslu;": "\u298D", |
| 8404 | "Lcaron;": "\u013D", |
| 8405 | "lcaron;": "\u013E", |
| 8406 | "Lcedil;": "\u013B", |
| 8407 | "lcedil;": "\u013C", |
| 8408 | "lceil;": "\u2308", |
| 8409 | "lcub;": "\u007B", |
| 8410 | "Lcy;": "\u041B", |
| 8411 | "lcy;": "\u043B", |
| 8412 | "ldca;": "\u2936", |
| 8413 | "ldquo;": "\u201C", |
| 8414 | "ldquor;": "\u201E", |
| 8415 | "ldrdhar;": "\u2967", |
| 8416 | "ldrushar;": "\u294B", |
| 8417 | "ldsh;": "\u21B2", |
| 8418 | "le;": "\u2264", |
| 8419 | "lE;": "\u2266", |
| 8420 | "LeftAngleBracket;": "\u27E8", |
| 8421 | "LeftArrowBar;": "\u21E4", |
| 8422 | "leftarrow;": "\u2190", |
| 8423 | "LeftArrow;": "\u2190", |
| 8424 | "Leftarrow;": "\u21D0", |
| 8425 | "LeftArrowRightArrow;": "\u21C6", |
| 8426 | "leftarrowtail;": "\u21A2", |
| 8427 | "LeftCeiling;": "\u2308", |
| 8428 | "LeftDoubleBracket;": "\u27E6", |
| 8429 | "LeftDownTeeVector;": "\u2961", |
| 8430 | "LeftDownVectorBar;": "\u2959", |
| 8431 | "LeftDownVector;": "\u21C3", |
| 8432 | "LeftFloor;": "\u230A", |
| 8433 | "leftharpoondown;": "\u21BD", |
| 8434 | "leftharpoonup;": "\u21BC", |
| 8435 | "leftleftarrows;": "\u21C7", |
| 8436 | "leftrightarrow;": "\u2194", |
| 8437 | "LeftRightArrow;": "\u2194", |
| 8438 | "Leftrightarrow;": "\u21D4", |
| 8439 | "leftrightarrows;": "\u21C6", |
| 8440 | "leftrightharpoons;": "\u21CB", |
| 8441 | "leftrightsquigarrow;": "\u21AD", |
| 8442 | "LeftRightVector;": "\u294E", |
| 8443 | "LeftTeeArrow;": "\u21A4", |
| 8444 | "LeftTee;": "\u22A3", |
| 8445 | "LeftTeeVector;": "\u295A", |
| 8446 | "leftthreetimes;": "\u22CB", |
| 8447 | "LeftTriangleBar;": "\u29CF", |
| 8448 | "LeftTriangle;": "\u22B2", |
| 8449 | "LeftTriangleEqual;": "\u22B4", |
| 8450 | "LeftUpDownVector;": "\u2951", |
| 8451 | "LeftUpTeeVector;": "\u2960", |
| 8452 | "LeftUpVectorBar;": "\u2958", |
| 8453 | "LeftUpVector;": "\u21BF", |
| 8454 | "LeftVectorBar;": "\u2952", |
| 8455 | "LeftVector;": "\u21BC", |
| 8456 | "lEg;": "\u2A8B", |
| 8457 | "leg;": "\u22DA", |
| 8458 | "leq;": "\u2264", |
| 8459 | "leqq;": "\u2266", |
| 8460 | "leqslant;": "\u2A7D", |
| 8461 | "lescc;": "\u2AA8", |
| 8462 | "les;": "\u2A7D", |
| 8463 | "lesdot;": "\u2A7F", |
| 8464 | "lesdoto;": "\u2A81", |
| 8465 | "lesdotor;": "\u2A83", |
| 8466 | "lesg;": "\u22DA\uFE00", |
| 8467 | "lesges;": "\u2A93", |
| 8468 | "lessapprox;": "\u2A85", |
| 8469 | "lessdot;": "\u22D6", |
| 8470 | "lesseqgtr;": "\u22DA", |
| 8471 | "lesseqqgtr;": "\u2A8B", |
| 8472 | "LessEqualGreater;": "\u22DA", |
| 8473 | "LessFullEqual;": "\u2266", |
| 8474 | "LessGreater;": "\u2276", |
| 8475 | "lessgtr;": "\u2276", |
| 8476 | "LessLess;": "\u2AA1", |
| 8477 | "lesssim;": "\u2272", |
| 8478 | "LessSlantEqual;": "\u2A7D", |
| 8479 | "LessTilde;": "\u2272", |
| 8480 | "lfisht;": "\u297C", |
| 8481 | "lfloor;": "\u230A", |
| 8482 | "Lfr;": "\uD835\uDD0F", |
| 8483 | "lfr;": "\uD835\uDD29", |
| 8484 | "lg;": "\u2276", |
| 8485 | "lgE;": "\u2A91", |
| 8486 | "lHar;": "\u2962", |
| 8487 | "lhard;": "\u21BD", |
| 8488 | "lharu;": "\u21BC", |
| 8489 | "lharul;": "\u296A", |
| 8490 | "lhblk;": "\u2584", |
| 8491 | "LJcy;": "\u0409", |
| 8492 | "ljcy;": "\u0459", |
| 8493 | "llarr;": "\u21C7", |
| 8494 | "ll;": "\u226A", |
| 8495 | "Ll;": "\u22D8", |
| 8496 | "llcorner;": "\u231E", |
| 8497 | "Lleftarrow;": "\u21DA", |
| 8498 | "llhard;": "\u296B", |
| 8499 | "lltri;": "\u25FA", |
| 8500 | "Lmidot;": "\u013F", |
| 8501 | "lmidot;": "\u0140", |
| 8502 | "lmoustache;": "\u23B0", |
| 8503 | "lmoust;": "\u23B0", |
| 8504 | "lnap;": "\u2A89", |
| 8505 | "lnapprox;": "\u2A89", |
| 8506 | "lne;": "\u2A87", |
| 8507 | "lnE;": "\u2268", |
| 8508 | "lneq;": "\u2A87", |
| 8509 | "lneqq;": "\u2268", |
| 8510 | "lnsim;": "\u22E6", |
| 8511 | "loang;": "\u27EC", |
| 8512 | "loarr;": "\u21FD", |
| 8513 | "lobrk;": "\u27E6", |
| 8514 | "longleftarrow;": "\u27F5", |
| 8515 | "LongLeftArrow;": "\u27F5", |
| 8516 | "Longleftarrow;": "\u27F8", |
| 8517 | "longleftrightarrow;": "\u27F7", |
| 8518 | "LongLeftRightArrow;": "\u27F7", |
| 8519 | "Longleftrightarrow;": "\u27FA", |
| 8520 | "longmapsto;": "\u27FC", |
| 8521 | "longrightarrow;": "\u27F6", |
| 8522 | "LongRightArrow;": "\u27F6", |
| 8523 | "Longrightarrow;": "\u27F9", |
| 8524 | "looparrowleft;": "\u21AB", |
| 8525 | "looparrowright;": "\u21AC", |
| 8526 | "lopar;": "\u2985", |
| 8527 | "Lopf;": "\uD835\uDD43", |
| 8528 | "lopf;": "\uD835\uDD5D", |
| 8529 | "loplus;": "\u2A2D", |
| 8530 | "lotimes;": "\u2A34", |
| 8531 | "lowast;": "\u2217", |
| 8532 | "lowbar;": "\u005F", |
| 8533 | "LowerLeftArrow;": "\u2199", |
| 8534 | "LowerRightArrow;": "\u2198", |
| 8535 | "loz;": "\u25CA", |
| 8536 | "lozenge;": "\u25CA", |
| 8537 | "lozf;": "\u29EB", |
| 8538 | "lpar;": "\u0028", |
| 8539 | "lparlt;": "\u2993", |
| 8540 | "lrarr;": "\u21C6", |
| 8541 | "lrcorner;": "\u231F", |
| 8542 | "lrhar;": "\u21CB", |
| 8543 | "lrhard;": "\u296D", |
| 8544 | "lrm;": "\u200E", |
| 8545 | "lrtri;": "\u22BF", |
| 8546 | "lsaquo;": "\u2039", |
| 8547 | "lscr;": "\uD835\uDCC1", |
| 8548 | "Lscr;": "\u2112", |
| 8549 | "lsh;": "\u21B0", |
| 8550 | "Lsh;": "\u21B0", |
| 8551 | "lsim;": "\u2272", |
| 8552 | "lsime;": "\u2A8D", |
| 8553 | "lsimg;": "\u2A8F", |
| 8554 | "lsqb;": "\u005B", |
| 8555 | "lsquo;": "\u2018", |
| 8556 | "lsquor;": "\u201A", |
| 8557 | "Lstrok;": "\u0141", |
| 8558 | "lstrok;": "\u0142", |
| 8559 | "ltcc;": "\u2AA6", |
| 8560 | "ltcir;": "\u2A79", |
| 8561 | "lt;": "\u003C", |
| 8562 | "lt": "\u003C", |
| 8563 | "LT;": "\u003C", |
| 8564 | "LT": "\u003C", |
| 8565 | "Lt;": "\u226A", |
| 8566 | "ltdot;": "\u22D6", |
| 8567 | "lthree;": "\u22CB", |
| 8568 | "ltimes;": "\u22C9", |
| 8569 | "ltlarr;": "\u2976", |
| 8570 | "ltquest;": "\u2A7B", |
| 8571 | "ltri;": "\u25C3", |
| 8572 | "ltrie;": "\u22B4", |
| 8573 | "ltrif;": "\u25C2", |
| 8574 | "ltrPar;": "\u2996", |
| 8575 | "lurdshar;": "\u294A", |
| 8576 | "luruhar;": "\u2966", |
| 8577 | "lvertneqq;": "\u2268\uFE00", |
| 8578 | "lvnE;": "\u2268\uFE00", |
| 8579 | "macr;": "\u00AF", |
| 8580 | "macr": "\u00AF", |
| 8581 | "male;": "\u2642", |
| 8582 | "malt;": "\u2720", |
| 8583 | "maltese;": "\u2720", |
| 8584 | "Map;": "\u2905", |
| 8585 | "map;": "\u21A6", |
| 8586 | "mapsto;": "\u21A6", |
| 8587 | "mapstodown;": "\u21A7", |
| 8588 | "mapstoleft;": "\u21A4", |
| 8589 | "mapstoup;": "\u21A5", |
| 8590 | "marker;": "\u25AE", |
| 8591 | "mcomma;": "\u2A29", |
| 8592 | "Mcy;": "\u041C", |
| 8593 | "mcy;": "\u043C", |
| 8594 | "mdash;": "\u2014", |
| 8595 | "mDDot;": "\u223A", |
| 8596 | "measuredangle;": "\u2221", |
| 8597 | "MediumSpace;": "\u205F", |
| 8598 | "Mellintrf;": "\u2133", |
| 8599 | "Mfr;": "\uD835\uDD10", |
| 8600 | "mfr;": "\uD835\uDD2A", |
| 8601 | "mho;": "\u2127", |
| 8602 | "micro;": "\u00B5", |
| 8603 | "micro": "\u00B5", |
| 8604 | "midast;": "\u002A", |
| 8605 | "midcir;": "\u2AF0", |
| 8606 | "mid;": "\u2223", |
| 8607 | "middot;": "\u00B7", |
| 8608 | "middot": "\u00B7", |
| 8609 | "minusb;": "\u229F", |
| 8610 | "minus;": "\u2212", |
| 8611 | "minusd;": "\u2238", |
| 8612 | "minusdu;": "\u2A2A", |
| 8613 | "MinusPlus;": "\u2213", |
| 8614 | "mlcp;": "\u2ADB", |
| 8615 | "mldr;": "\u2026", |
| 8616 | "mnplus;": "\u2213", |
| 8617 | "models;": "\u22A7", |
| 8618 | "Mopf;": "\uD835\uDD44", |
| 8619 | "mopf;": "\uD835\uDD5E", |
| 8620 | "mp;": "\u2213", |
| 8621 | "mscr;": "\uD835\uDCC2", |
| 8622 | "Mscr;": "\u2133", |
| 8623 | "mstpos;": "\u223E", |
| 8624 | "Mu;": "\u039C", |
| 8625 | "mu;": "\u03BC", |
| 8626 | "multimap;": "\u22B8", |
| 8627 | "mumap;": "\u22B8", |
| 8628 | "nabla;": "\u2207", |
| 8629 | "Nacute;": "\u0143", |
| 8630 | "nacute;": "\u0144", |
| 8631 | "nang;": "\u2220\u20D2", |
| 8632 | "nap;": "\u2249", |
| 8633 | "napE;": "\u2A70\u0338", |
| 8634 | "napid;": "\u224B\u0338", |
| 8635 | "napos;": "\u0149", |
| 8636 | "napprox;": "\u2249", |
| 8637 | "natural;": "\u266E", |
| 8638 | "naturals;": "\u2115", |
| 8639 | "natur;": "\u266E", |
| 8640 | "nbsp;": "\u00A0", |
| 8641 | "nbsp": "\u00A0", |
| 8642 | "nbump;": "\u224E\u0338", |
| 8643 | "nbumpe;": "\u224F\u0338", |
| 8644 | "ncap;": "\u2A43", |
| 8645 | "Ncaron;": "\u0147", |
| 8646 | "ncaron;": "\u0148", |
| 8647 | "Ncedil;": "\u0145", |
| 8648 | "ncedil;": "\u0146", |
| 8649 | "ncong;": "\u2247", |
| 8650 | "ncongdot;": "\u2A6D\u0338", |
| 8651 | "ncup;": "\u2A42", |
| 8652 | "Ncy;": "\u041D", |
| 8653 | "ncy;": "\u043D", |
| 8654 | "ndash;": "\u2013", |
| 8655 | "nearhk;": "\u2924", |
| 8656 | "nearr;": "\u2197", |
| 8657 | "neArr;": "\u21D7", |
| 8658 | "nearrow;": "\u2197", |
| 8659 | "ne;": "\u2260", |
| 8660 | "nedot;": "\u2250\u0338", |
| 8661 | "NegativeMediumSpace;": "\u200B", |
| 8662 | "NegativeThickSpace;": "\u200B", |
| 8663 | "NegativeThinSpace;": "\u200B", |
| 8664 | "NegativeVeryThinSpace;": "\u200B", |
| 8665 | "nequiv;": "\u2262", |
| 8666 | "nesear;": "\u2928", |
| 8667 | "nesim;": "\u2242\u0338", |
| 8668 | "NestedGreaterGreater;": "\u226B", |
| 8669 | "NestedLessLess;": "\u226A", |
| 8670 | "NewLine;": "\u000A", |
| 8671 | "nexist;": "\u2204", |
| 8672 | "nexists;": "\u2204", |
| 8673 | "Nfr;": "\uD835\uDD11", |
| 8674 | "nfr;": "\uD835\uDD2B", |
| 8675 | "ngE;": "\u2267\u0338", |
| 8676 | "nge;": "\u2271", |
| 8677 | "ngeq;": "\u2271", |
| 8678 | "ngeqq;": "\u2267\u0338", |
| 8679 | "ngeqslant;": "\u2A7E\u0338", |
| 8680 | "nges;": "\u2A7E\u0338", |
| 8681 | "nGg;": "\u22D9\u0338", |
| 8682 | "ngsim;": "\u2275", |
| 8683 | "nGt;": "\u226B\u20D2", |
| 8684 | "ngt;": "\u226F", |
| 8685 | "ngtr;": "\u226F", |
| 8686 | "nGtv;": "\u226B\u0338", |
| 8687 | "nharr;": "\u21AE", |
| 8688 | "nhArr;": "\u21CE", |
| 8689 | "nhpar;": "\u2AF2", |
| 8690 | "ni;": "\u220B", |
| 8691 | "nis;": "\u22FC", |
| 8692 | "nisd;": "\u22FA", |
| 8693 | "niv;": "\u220B", |
| 8694 | "NJcy;": "\u040A", |
| 8695 | "njcy;": "\u045A", |
| 8696 | "nlarr;": "\u219A", |
| 8697 | "nlArr;": "\u21CD", |
| 8698 | "nldr;": "\u2025", |
| 8699 | "nlE;": "\u2266\u0338", |
| 8700 | "nle;": "\u2270", |
| 8701 | "nleftarrow;": "\u219A", |
| 8702 | "nLeftarrow;": "\u21CD", |
| 8703 | "nleftrightarrow;": "\u21AE", |
| 8704 | "nLeftrightarrow;": "\u21CE", |
| 8705 | "nleq;": "\u2270", |
| 8706 | "nleqq;": "\u2266\u0338", |
| 8707 | "nleqslant;": "\u2A7D\u0338", |
| 8708 | "nles;": "\u2A7D\u0338", |
| 8709 | "nless;": "\u226E", |
| 8710 | "nLl;": "\u22D8\u0338", |
| 8711 | "nlsim;": "\u2274", |
| 8712 | "nLt;": "\u226A\u20D2", |
| 8713 | "nlt;": "\u226E", |
| 8714 | "nltri;": "\u22EA", |
| 8715 | "nltrie;": "\u22EC", |
| 8716 | "nLtv;": "\u226A\u0338", |
| 8717 | "nmid;": "\u2224", |
| 8718 | "NoBreak;": "\u2060", |
| 8719 | "NonBreakingSpace;": "\u00A0", |
| 8720 | "nopf;": "\uD835\uDD5F", |
| 8721 | "Nopf;": "\u2115", |
| 8722 | "Not;": "\u2AEC", |
| 8723 | "not;": "\u00AC", |
| 8724 | "not": "\u00AC", |
| 8725 | "NotCongruent;": "\u2262", |
| 8726 | "NotCupCap;": "\u226D", |
| 8727 | "NotDoubleVerticalBar;": "\u2226", |
| 8728 | "NotElement;": "\u2209", |
| 8729 | "NotEqual;": "\u2260", |
| 8730 | "NotEqualTilde;": "\u2242\u0338", |
| 8731 | "NotExists;": "\u2204", |
| 8732 | "NotGreater;": "\u226F", |
| 8733 | "NotGreaterEqual;": "\u2271", |
| 8734 | "NotGreaterFullEqual;": "\u2267\u0338", |
| 8735 | "NotGreaterGreater;": "\u226B\u0338", |
| 8736 | "NotGreaterLess;": "\u2279", |
| 8737 | "NotGreaterSlantEqual;": "\u2A7E\u0338", |
| 8738 | "NotGreaterTilde;": "\u2275", |
| 8739 | "NotHumpDownHump;": "\u224E\u0338", |
| 8740 | "NotHumpEqual;": "\u224F\u0338", |
| 8741 | "notin;": "\u2209", |
| 8742 | "notindot;": "\u22F5\u0338", |
| 8743 | "notinE;": "\u22F9\u0338", |
| 8744 | "notinva;": "\u2209", |
| 8745 | "notinvb;": "\u22F7", |
| 8746 | "notinvc;": "\u22F6", |
| 8747 | "NotLeftTriangleBar;": "\u29CF\u0338", |
| 8748 | "NotLeftTriangle;": "\u22EA", |
| 8749 | "NotLeftTriangleEqual;": "\u22EC", |
| 8750 | "NotLess;": "\u226E", |
| 8751 | "NotLessEqual;": "\u2270", |
| 8752 | "NotLessGreater;": "\u2278", |
| 8753 | "NotLessLess;": "\u226A\u0338", |
| 8754 | "NotLessSlantEqual;": "\u2A7D\u0338", |
| 8755 | "NotLessTilde;": "\u2274", |
| 8756 | "NotNestedGreaterGreater;": "\u2AA2\u0338", |
| 8757 | "NotNestedLessLess;": "\u2AA1\u0338", |
| 8758 | "notni;": "\u220C", |
| 8759 | "notniva;": "\u220C", |
| 8760 | "notnivb;": "\u22FE", |
| 8761 | "notnivc;": "\u22FD", |
| 8762 | "NotPrecedes;": "\u2280", |
| 8763 | "NotPrecedesEqual;": "\u2AAF\u0338", |
| 8764 | "NotPrecedesSlantEqual;": "\u22E0", |
| 8765 | "NotReverseElement;": "\u220C", |
| 8766 | "NotRightTriangleBar;": "\u29D0\u0338", |
| 8767 | "NotRightTriangle;": "\u22EB", |
| 8768 | "NotRightTriangleEqual;": "\u22ED", |
| 8769 | "NotSquareSubset;": "\u228F\u0338", |
| 8770 | "NotSquareSubsetEqual;": "\u22E2", |
| 8771 | "NotSquareSuperset;": "\u2290\u0338", |
| 8772 | "NotSquareSupersetEqual;": "\u22E3", |
| 8773 | "NotSubset;": "\u2282\u20D2", |
| 8774 | "NotSubsetEqual;": "\u2288", |
| 8775 | "NotSucceeds;": "\u2281", |
| 8776 | "NotSucceedsEqual;": "\u2AB0\u0338", |
| 8777 | "NotSucceedsSlantEqual;": "\u22E1", |
| 8778 | "NotSucceedsTilde;": "\u227F\u0338", |
| 8779 | "NotSuperset;": "\u2283\u20D2", |
| 8780 | "NotSupersetEqual;": "\u2289", |
| 8781 | "NotTilde;": "\u2241", |
| 8782 | "NotTildeEqual;": "\u2244", |
| 8783 | "NotTildeFullEqual;": "\u2247", |
| 8784 | "NotTildeTilde;": "\u2249", |
| 8785 | "NotVerticalBar;": "\u2224", |
| 8786 | "nparallel;": "\u2226", |
| 8787 | "npar;": "\u2226", |
| 8788 | "nparsl;": "\u2AFD\u20E5", |
| 8789 | "npart;": "\u2202\u0338", |
| 8790 | "npolint;": "\u2A14", |
| 8791 | "npr;": "\u2280", |
| 8792 | "nprcue;": "\u22E0", |
| 8793 | "nprec;": "\u2280", |
| 8794 | "npreceq;": "\u2AAF\u0338", |
| 8795 | "npre;": "\u2AAF\u0338", |
| 8796 | "nrarrc;": "\u2933\u0338", |
| 8797 | "nrarr;": "\u219B", |
| 8798 | "nrArr;": "\u21CF", |
| 8799 | "nrarrw;": "\u219D\u0338", |
| 8800 | "nrightarrow;": "\u219B", |
| 8801 | "nRightarrow;": "\u21CF", |
| 8802 | "nrtri;": "\u22EB", |
| 8803 | "nrtrie;": "\u22ED", |
| 8804 | "nsc;": "\u2281", |
| 8805 | "nsccue;": "\u22E1", |
| 8806 | "nsce;": "\u2AB0\u0338", |
| 8807 | "Nscr;": "\uD835\uDCA9", |
| 8808 | "nscr;": "\uD835\uDCC3", |
| 8809 | "nshortmid;": "\u2224", |
| 8810 | "nshortparallel;": "\u2226", |
| 8811 | "nsim;": "\u2241", |
| 8812 | "nsime;": "\u2244", |
| 8813 | "nsimeq;": "\u2244", |
| 8814 | "nsmid;": "\u2224", |
| 8815 | "nspar;": "\u2226", |
| 8816 | "nsqsube;": "\u22E2", |
| 8817 | "nsqsupe;": "\u22E3", |
| 8818 | "nsub;": "\u2284", |
| 8819 | "nsubE;": "\u2AC5\u0338", |
| 8820 | "nsube;": "\u2288", |
| 8821 | "nsubset;": "\u2282\u20D2", |
| 8822 | "nsubseteq;": "\u2288", |
| 8823 | "nsubseteqq;": "\u2AC5\u0338", |
| 8824 | "nsucc;": "\u2281", |
| 8825 | "nsucceq;": "\u2AB0\u0338", |
| 8826 | "nsup;": "\u2285", |
| 8827 | "nsupE;": "\u2AC6\u0338", |
| 8828 | "nsupe;": "\u2289", |
| 8829 | "nsupset;": "\u2283\u20D2", |
| 8830 | "nsupseteq;": "\u2289", |
| 8831 | "nsupseteqq;": "\u2AC6\u0338", |
| 8832 | "ntgl;": "\u2279", |
| 8833 | "Ntilde;": "\u00D1", |
| 8834 | "Ntilde": "\u00D1", |
| 8835 | "ntilde;": "\u00F1", |
| 8836 | "ntilde": "\u00F1", |
| 8837 | "ntlg;": "\u2278", |
| 8838 | "ntriangleleft;": "\u22EA", |
| 8839 | "ntrianglelefteq;": "\u22EC", |
| 8840 | "ntriangleright;": "\u22EB", |
| 8841 | "ntrianglerighteq;": "\u22ED", |
| 8842 | "Nu;": "\u039D", |
| 8843 | "nu;": "\u03BD", |
| 8844 | "num;": "\u0023", |
| 8845 | "numero;": "\u2116", |
| 8846 | "numsp;": "\u2007", |
| 8847 | "nvap;": "\u224D\u20D2", |
| 8848 | "nvdash;": "\u22AC", |
| 8849 | "nvDash;": "\u22AD", |
| 8850 | "nVdash;": "\u22AE", |
| 8851 | "nVDash;": "\u22AF", |
| 8852 | "nvge;": "\u2265\u20D2", |
| 8853 | "nvgt;": "\u003E\u20D2", |
| 8854 | "nvHarr;": "\u2904", |
| 8855 | "nvinfin;": "\u29DE", |
| 8856 | "nvlArr;": "\u2902", |
| 8857 | "nvle;": "\u2264\u20D2", |
| 8858 | "nvlt;": "\u003C\u20D2", |
| 8859 | "nvltrie;": "\u22B4\u20D2", |
| 8860 | "nvrArr;": "\u2903", |
| 8861 | "nvrtrie;": "\u22B5\u20D2", |
| 8862 | "nvsim;": "\u223C\u20D2", |
| 8863 | "nwarhk;": "\u2923", |
| 8864 | "nwarr;": "\u2196", |
| 8865 | "nwArr;": "\u21D6", |
| 8866 | "nwarrow;": "\u2196", |
| 8867 | "nwnear;": "\u2927", |
| 8868 | "Oacute;": "\u00D3", |
| 8869 | "Oacute": "\u00D3", |
| 8870 | "oacute;": "\u00F3", |
| 8871 | "oacute": "\u00F3", |
| 8872 | "oast;": "\u229B", |
| 8873 | "Ocirc;": "\u00D4", |
| 8874 | "Ocirc": "\u00D4", |
| 8875 | "ocirc;": "\u00F4", |
| 8876 | "ocirc": "\u00F4", |
| 8877 | "ocir;": "\u229A", |
| 8878 | "Ocy;": "\u041E", |
| 8879 | "ocy;": "\u043E", |
| 8880 | "odash;": "\u229D", |
| 8881 | "Odblac;": "\u0150", |
| 8882 | "odblac;": "\u0151", |
| 8883 | "odiv;": "\u2A38", |
| 8884 | "odot;": "\u2299", |
| 8885 | "odsold;": "\u29BC", |
| 8886 | "OElig;": "\u0152", |
| 8887 | "oelig;": "\u0153", |
| 8888 | "ofcir;": "\u29BF", |
| 8889 | "Ofr;": "\uD835\uDD12", |
| 8890 | "ofr;": "\uD835\uDD2C", |
| 8891 | "ogon;": "\u02DB", |
| 8892 | "Ograve;": "\u00D2", |
| 8893 | "Ograve": "\u00D2", |
| 8894 | "ograve;": "\u00F2", |
| 8895 | "ograve": "\u00F2", |
| 8896 | "ogt;": "\u29C1", |
| 8897 | "ohbar;": "\u29B5", |
| 8898 | "ohm;": "\u03A9", |
| 8899 | "oint;": "\u222E", |
| 8900 | "olarr;": "\u21BA", |
| 8901 | "olcir;": "\u29BE", |
| 8902 | "olcross;": "\u29BB", |
| 8903 | "oline;": "\u203E", |
| 8904 | "olt;": "\u29C0", |
| 8905 | "Omacr;": "\u014C", |
| 8906 | "omacr;": "\u014D", |
| 8907 | "Omega;": "\u03A9", |
| 8908 | "omega;": "\u03C9", |
| 8909 | "Omicron;": "\u039F", |
| 8910 | "omicron;": "\u03BF", |
| 8911 | "omid;": "\u29B6", |
| 8912 | "ominus;": "\u2296", |
| 8913 | "Oopf;": "\uD835\uDD46", |
| 8914 | "oopf;": "\uD835\uDD60", |
| 8915 | "opar;": "\u29B7", |
| 8916 | "OpenCurlyDoubleQuote;": "\u201C", |
| 8917 | "OpenCurlyQuote;": "\u2018", |
| 8918 | "operp;": "\u29B9", |
| 8919 | "oplus;": "\u2295", |
| 8920 | "orarr;": "\u21BB", |
| 8921 | "Or;": "\u2A54", |
| 8922 | "or;": "\u2228", |
| 8923 | "ord;": "\u2A5D", |
| 8924 | "order;": "\u2134", |
| 8925 | "orderof;": "\u2134", |
| 8926 | "ordf;": "\u00AA", |
| 8927 | "ordf": "\u00AA", |
| 8928 | "ordm;": "\u00BA", |
| 8929 | "ordm": "\u00BA", |
| 8930 | "origof;": "\u22B6", |
| 8931 | "oror;": "\u2A56", |
| 8932 | "orslope;": "\u2A57", |
| 8933 | "orv;": "\u2A5B", |
| 8934 | "oS;": "\u24C8", |
| 8935 | "Oscr;": "\uD835\uDCAA", |
| 8936 | "oscr;": "\u2134", |
| 8937 | "Oslash;": "\u00D8", |
| 8938 | "Oslash": "\u00D8", |
| 8939 | "oslash;": "\u00F8", |
| 8940 | "oslash": "\u00F8", |
| 8941 | "osol;": "\u2298", |
| 8942 | "Otilde;": "\u00D5", |
| 8943 | "Otilde": "\u00D5", |
| 8944 | "otilde;": "\u00F5", |
| 8945 | "otilde": "\u00F5", |
| 8946 | "otimesas;": "\u2A36", |
| 8947 | "Otimes;": "\u2A37", |
| 8948 | "otimes;": "\u2297", |
| 8949 | "Ouml;": "\u00D6", |
| 8950 | "Ouml": "\u00D6", |
| 8951 | "ouml;": "\u00F6", |
| 8952 | "ouml": "\u00F6", |
| 8953 | "ovbar;": "\u233D", |
| 8954 | "OverBar;": "\u203E", |
| 8955 | "OverBrace;": "\u23DE", |
| 8956 | "OverBracket;": "\u23B4", |
| 8957 | "OverParenthesis;": "\u23DC", |
| 8958 | "para;": "\u00B6", |
| 8959 | "para": "\u00B6", |
| 8960 | "parallel;": "\u2225", |
| 8961 | "par;": "\u2225", |
| 8962 | "parsim;": "\u2AF3", |
| 8963 | "parsl;": "\u2AFD", |
| 8964 | "part;": "\u2202", |
| 8965 | "PartialD;": "\u2202", |
| 8966 | "Pcy;": "\u041F", |
| 8967 | "pcy;": "\u043F", |
| 8968 | "percnt;": "\u0025", |
| 8969 | "period;": "\u002E", |
| 8970 | "permil;": "\u2030", |
| 8971 | "perp;": "\u22A5", |
| 8972 | "pertenk;": "\u2031", |
| 8973 | "Pfr;": "\uD835\uDD13", |
| 8974 | "pfr;": "\uD835\uDD2D", |
| 8975 | "Phi;": "\u03A6", |
| 8976 | "phi;": "\u03C6", |
| 8977 | "phiv;": "\u03D5", |
| 8978 | "phmmat;": "\u2133", |
| 8979 | "phone;": "\u260E", |
| 8980 | "Pi;": "\u03A0", |
| 8981 | "pi;": "\u03C0", |
| 8982 | "pitchfork;": "\u22D4", |
| 8983 | "piv;": "\u03D6", |
| 8984 | "planck;": "\u210F", |
| 8985 | "planckh;": "\u210E", |
| 8986 | "plankv;": "\u210F", |
| 8987 | "plusacir;": "\u2A23", |
| 8988 | "plusb;": "\u229E", |
| 8989 | "pluscir;": "\u2A22", |
| 8990 | "plus;": "\u002B", |
| 8991 | "plusdo;": "\u2214", |
| 8992 | "plusdu;": "\u2A25", |
| 8993 | "pluse;": "\u2A72", |
| 8994 | "PlusMinus;": "\u00B1", |
| 8995 | "plusmn;": "\u00B1", |
| 8996 | "plusmn": "\u00B1", |
| 8997 | "plussim;": "\u2A26", |
| 8998 | "plustwo;": "\u2A27", |
| 8999 | "pm;": "\u00B1", |
| 9000 | "Poincareplane;": "\u210C", |
| 9001 | "pointint;": "\u2A15", |
| 9002 | "popf;": "\uD835\uDD61", |
| 9003 | "Popf;": "\u2119", |
| 9004 | "pound;": "\u00A3", |
| 9005 | "pound": "\u00A3", |
| 9006 | "prap;": "\u2AB7", |
| 9007 | "Pr;": "\u2ABB", |
| 9008 | "pr;": "\u227A", |
| 9009 | "prcue;": "\u227C", |
| 9010 | "precapprox;": "\u2AB7", |
| 9011 | "prec;": "\u227A", |
| 9012 | "preccurlyeq;": "\u227C", |
| 9013 | "Precedes;": "\u227A", |
| 9014 | "PrecedesEqual;": "\u2AAF", |
| 9015 | "PrecedesSlantEqual;": "\u227C", |
| 9016 | "PrecedesTilde;": "\u227E", |
| 9017 | "preceq;": "\u2AAF", |
| 9018 | "precnapprox;": "\u2AB9", |
| 9019 | "precneqq;": "\u2AB5", |
| 9020 | "precnsim;": "\u22E8", |
| 9021 | "pre;": "\u2AAF", |
| 9022 | "prE;": "\u2AB3", |
| 9023 | "precsim;": "\u227E", |
| 9024 | "prime;": "\u2032", |
| 9025 | "Prime;": "\u2033", |
| 9026 | "primes;": "\u2119", |
| 9027 | "prnap;": "\u2AB9", |
| 9028 | "prnE;": "\u2AB5", |
| 9029 | "prnsim;": "\u22E8", |
| 9030 | "prod;": "\u220F", |
| 9031 | "Product;": "\u220F", |
| 9032 | "profalar;": "\u232E", |
| 9033 | "profline;": "\u2312", |
| 9034 | "profsurf;": "\u2313", |
| 9035 | "prop;": "\u221D", |
| 9036 | "Proportional;": "\u221D", |
| 9037 | "Proportion;": "\u2237", |
| 9038 | "propto;": "\u221D", |
| 9039 | "prsim;": "\u227E", |
| 9040 | "prurel;": "\u22B0", |
| 9041 | "Pscr;": "\uD835\uDCAB", |
| 9042 | "pscr;": "\uD835\uDCC5", |
| 9043 | "Psi;": "\u03A8", |
| 9044 | "psi;": "\u03C8", |
| 9045 | "puncsp;": "\u2008", |
| 9046 | "Qfr;": "\uD835\uDD14", |
| 9047 | "qfr;": "\uD835\uDD2E", |
| 9048 | "qint;": "\u2A0C", |
| 9049 | "qopf;": "\uD835\uDD62", |
| 9050 | "Qopf;": "\u211A", |
| 9051 | "qprime;": "\u2057", |
| 9052 | "Qscr;": "\uD835\uDCAC", |
| 9053 | "qscr;": "\uD835\uDCC6", |
| 9054 | "quaternions;": "\u210D", |
| 9055 | "quatint;": "\u2A16", |
| 9056 | "quest;": "\u003F", |
| 9057 | "questeq;": "\u225F", |
| 9058 | "quot;": "\u0022", |
| 9059 | "quot": "\u0022", |
| 9060 | "QUOT;": "\u0022", |
| 9061 | "QUOT": "\u0022", |
| 9062 | "rAarr;": "\u21DB", |
| 9063 | "race;": "\u223D\u0331", |
| 9064 | "Racute;": "\u0154", |
| 9065 | "racute;": "\u0155", |
| 9066 | "radic;": "\u221A", |
| 9067 | "raemptyv;": "\u29B3", |
| 9068 | "rang;": "\u27E9", |
| 9069 | "Rang;": "\u27EB", |
| 9070 | "rangd;": "\u2992", |
| 9071 | "range;": "\u29A5", |
| 9072 | "rangle;": "\u27E9", |
| 9073 | "raquo;": "\u00BB", |
| 9074 | "raquo": "\u00BB", |
| 9075 | "rarrap;": "\u2975", |
| 9076 | "rarrb;": "\u21E5", |
| 9077 | "rarrbfs;": "\u2920", |
| 9078 | "rarrc;": "\u2933", |
| 9079 | "rarr;": "\u2192", |
| 9080 | "Rarr;": "\u21A0", |
| 9081 | "rArr;": "\u21D2", |
| 9082 | "rarrfs;": "\u291E", |
| 9083 | "rarrhk;": "\u21AA", |
| 9084 | "rarrlp;": "\u21AC", |
| 9085 | "rarrpl;": "\u2945", |
| 9086 | "rarrsim;": "\u2974", |
| 9087 | "Rarrtl;": "\u2916", |
| 9088 | "rarrtl;": "\u21A3", |
| 9089 | "rarrw;": "\u219D", |
| 9090 | "ratail;": "\u291A", |
| 9091 | "rAtail;": "\u291C", |
| 9092 | "ratio;": "\u2236", |
| 9093 | "rationals;": "\u211A", |
| 9094 | "rbarr;": "\u290D", |
| 9095 | "rBarr;": "\u290F", |
| 9096 | "RBarr;": "\u2910", |
| 9097 | "rbbrk;": "\u2773", |
| 9098 | "rbrace;": "\u007D", |
| 9099 | "rbrack;": "\u005D", |
| 9100 | "rbrke;": "\u298C", |
| 9101 | "rbrksld;": "\u298E", |
| 9102 | "rbrkslu;": "\u2990", |
| 9103 | "Rcaron;": "\u0158", |
| 9104 | "rcaron;": "\u0159", |
| 9105 | "Rcedil;": "\u0156", |
| 9106 | "rcedil;": "\u0157", |
| 9107 | "rceil;": "\u2309", |
| 9108 | "rcub;": "\u007D", |
| 9109 | "Rcy;": "\u0420", |
| 9110 | "rcy;": "\u0440", |
| 9111 | "rdca;": "\u2937", |
| 9112 | "rdldhar;": "\u2969", |
| 9113 | "rdquo;": "\u201D", |
| 9114 | "rdquor;": "\u201D", |
| 9115 | "rdsh;": "\u21B3", |
| 9116 | "real;": "\u211C", |
| 9117 | "realine;": "\u211B", |
| 9118 | "realpart;": "\u211C", |
| 9119 | "reals;": "\u211D", |
| 9120 | "Re;": "\u211C", |
| 9121 | "rect;": "\u25AD", |
| 9122 | "reg;": "\u00AE", |
| 9123 | "reg": "\u00AE", |
| 9124 | "REG;": "\u00AE", |
| 9125 | "REG": "\u00AE", |
| 9126 | "ReverseElement;": "\u220B", |
| 9127 | "ReverseEquilibrium;": "\u21CB", |
| 9128 | "ReverseUpEquilibrium;": "\u296F", |
| 9129 | "rfisht;": "\u297D", |
| 9130 | "rfloor;": "\u230B", |
| 9131 | "rfr;": "\uD835\uDD2F", |
| 9132 | "Rfr;": "\u211C", |
| 9133 | "rHar;": "\u2964", |
| 9134 | "rhard;": "\u21C1", |
| 9135 | "rharu;": "\u21C0", |
| 9136 | "rharul;": "\u296C", |
| 9137 | "Rho;": "\u03A1", |
| 9138 | "rho;": "\u03C1", |
| 9139 | "rhov;": "\u03F1", |
| 9140 | "RightAngleBracket;": "\u27E9", |
| 9141 | "RightArrowBar;": "\u21E5", |
| 9142 | "rightarrow;": "\u2192", |
| 9143 | "RightArrow;": "\u2192", |
| 9144 | "Rightarrow;": "\u21D2", |
| 9145 | "RightArrowLeftArrow;": "\u21C4", |
| 9146 | "rightarrowtail;": "\u21A3", |
| 9147 | "RightCeiling;": "\u2309", |
| 9148 | "RightDoubleBracket;": "\u27E7", |
| 9149 | "RightDownTeeVector;": "\u295D", |
| 9150 | "RightDownVectorBar;": "\u2955", |
| 9151 | "RightDownVector;": "\u21C2", |
| 9152 | "RightFloor;": "\u230B", |
| 9153 | "rightharpoondown;": "\u21C1", |
| 9154 | "rightharpoonup;": "\u21C0", |
| 9155 | "rightleftarrows;": "\u21C4", |
| 9156 | "rightleftharpoons;": "\u21CC", |
| 9157 | "rightrightarrows;": "\u21C9", |
| 9158 | "rightsquigarrow;": "\u219D", |
| 9159 | "RightTeeArrow;": "\u21A6", |
| 9160 | "RightTee;": "\u22A2", |
| 9161 | "RightTeeVector;": "\u295B", |
| 9162 | "rightthreetimes;": "\u22CC", |
| 9163 | "RightTriangleBar;": "\u29D0", |
| 9164 | "RightTriangle;": "\u22B3", |
| 9165 | "RightTriangleEqual;": "\u22B5", |
| 9166 | "RightUpDownVector;": "\u294F", |
| 9167 | "RightUpTeeVector;": "\u295C", |
| 9168 | "RightUpVectorBar;": "\u2954", |
| 9169 | "RightUpVector;": "\u21BE", |
| 9170 | "RightVectorBar;": "\u2953", |
| 9171 | "RightVector;": "\u21C0", |
| 9172 | "ring;": "\u02DA", |
| 9173 | "risingdotseq;": "\u2253", |
| 9174 | "rlarr;": "\u21C4", |
| 9175 | "rlhar;": "\u21CC", |
| 9176 | "rlm;": "\u200F", |
| 9177 | "rmoustache;": "\u23B1", |
| 9178 | "rmoust;": "\u23B1", |
| 9179 | "rnmid;": "\u2AEE", |
| 9180 | "roang;": "\u27ED", |
| 9181 | "roarr;": "\u21FE", |
| 9182 | "robrk;": "\u27E7", |
| 9183 | "ropar;": "\u2986", |
| 9184 | "ropf;": "\uD835\uDD63", |
| 9185 | "Ropf;": "\u211D", |
| 9186 | "roplus;": "\u2A2E", |
| 9187 | "rotimes;": "\u2A35", |
| 9188 | "RoundImplies;": "\u2970", |
| 9189 | "rpar;": "\u0029", |
| 9190 | "rpargt;": "\u2994", |
| 9191 | "rppolint;": "\u2A12", |
| 9192 | "rrarr;": "\u21C9", |
| 9193 | "Rrightarrow;": "\u21DB", |
| 9194 | "rsaquo;": "\u203A", |
| 9195 | "rscr;": "\uD835\uDCC7", |
| 9196 | "Rscr;": "\u211B", |
| 9197 | "rsh;": "\u21B1", |
| 9198 | "Rsh;": "\u21B1", |
| 9199 | "rsqb;": "\u005D", |
| 9200 | "rsquo;": "\u2019", |
| 9201 | "rsquor;": "\u2019", |
| 9202 | "rthree;": "\u22CC", |
| 9203 | "rtimes;": "\u22CA", |
| 9204 | "rtri;": "\u25B9", |
| 9205 | "rtrie;": "\u22B5", |
| 9206 | "rtrif;": "\u25B8", |
| 9207 | "rtriltri;": "\u29CE", |
| 9208 | "RuleDelayed;": "\u29F4", |
| 9209 | "ruluhar;": "\u2968", |
| 9210 | "rx;": "\u211E", |
| 9211 | "Sacute;": "\u015A", |
| 9212 | "sacute;": "\u015B", |
| 9213 | "sbquo;": "\u201A", |
| 9214 | "scap;": "\u2AB8", |
| 9215 | "Scaron;": "\u0160", |
| 9216 | "scaron;": "\u0161", |
| 9217 | "Sc;": "\u2ABC", |
| 9218 | "sc;": "\u227B", |
| 9219 | "sccue;": "\u227D", |
| 9220 | "sce;": "\u2AB0", |
| 9221 | "scE;": "\u2AB4", |
| 9222 | "Scedil;": "\u015E", |
| 9223 | "scedil;": "\u015F", |
| 9224 | "Scirc;": "\u015C", |
| 9225 | "scirc;": "\u015D", |
| 9226 | "scnap;": "\u2ABA", |
| 9227 | "scnE;": "\u2AB6", |
| 9228 | "scnsim;": "\u22E9", |
| 9229 | "scpolint;": "\u2A13", |
| 9230 | "scsim;": "\u227F", |
| 9231 | "Scy;": "\u0421", |
| 9232 | "scy;": "\u0441", |
| 9233 | "sdotb;": "\u22A1", |
| 9234 | "sdot;": "\u22C5", |
| 9235 | "sdote;": "\u2A66", |
| 9236 | "searhk;": "\u2925", |
| 9237 | "searr;": "\u2198", |
| 9238 | "seArr;": "\u21D8", |
| 9239 | "searrow;": "\u2198", |
| 9240 | "sect;": "\u00A7", |
| 9241 | "sect": "\u00A7", |
| 9242 | "semi;": "\u003B", |
| 9243 | "seswar;": "\u2929", |
| 9244 | "setminus;": "\u2216", |
| 9245 | "setmn;": "\u2216", |
| 9246 | "sext;": "\u2736", |
| 9247 | "Sfr;": "\uD835\uDD16", |
| 9248 | "sfr;": "\uD835\uDD30", |
| 9249 | "sfrown;": "\u2322", |
| 9250 | "sharp;": "\u266F", |
| 9251 | "SHCHcy;": "\u0429", |
| 9252 | "shchcy;": "\u0449", |
| 9253 | "SHcy;": "\u0428", |
| 9254 | "shcy;": "\u0448", |
| 9255 | "ShortDownArrow;": "\u2193", |
| 9256 | "ShortLeftArrow;": "\u2190", |
| 9257 | "shortmid;": "\u2223", |
| 9258 | "shortparallel;": "\u2225", |
| 9259 | "ShortRightArrow;": "\u2192", |
| 9260 | "ShortUpArrow;": "\u2191", |
| 9261 | "shy;": "\u00AD", |
| 9262 | "shy": "\u00AD", |
| 9263 | "Sigma;": "\u03A3", |
| 9264 | "sigma;": "\u03C3", |
| 9265 | "sigmaf;": "\u03C2", |
| 9266 | "sigmav;": "\u03C2", |
| 9267 | "sim;": "\u223C", |
| 9268 | "simdot;": "\u2A6A", |
| 9269 | "sime;": "\u2243", |
| 9270 | "simeq;": "\u2243", |
| 9271 | "simg;": "\u2A9E", |
| 9272 | "simgE;": "\u2AA0", |
| 9273 | "siml;": "\u2A9D", |
| 9274 | "simlE;": "\u2A9F", |
| 9275 | "simne;": "\u2246", |
| 9276 | "simplus;": "\u2A24", |
| 9277 | "simrarr;": "\u2972", |
| 9278 | "slarr;": "\u2190", |
| 9279 | "SmallCircle;": "\u2218", |
| 9280 | "smallsetminus;": "\u2216", |
| 9281 | "smashp;": "\u2A33", |
| 9282 | "smeparsl;": "\u29E4", |
| 9283 | "smid;": "\u2223", |
| 9284 | "smile;": "\u2323", |
| 9285 | "smt;": "\u2AAA", |
| 9286 | "smte;": "\u2AAC", |
| 9287 | "smtes;": "\u2AAC\uFE00", |
| 9288 | "SOFTcy;": "\u042C", |
| 9289 | "softcy;": "\u044C", |
| 9290 | "solbar;": "\u233F", |
| 9291 | "solb;": "\u29C4", |
| 9292 | "sol;": "\u002F", |
| 9293 | "Sopf;": "\uD835\uDD4A", |
| 9294 | "sopf;": "\uD835\uDD64", |
| 9295 | "spades;": "\u2660", |
| 9296 | "spadesuit;": "\u2660", |
| 9297 | "spar;": "\u2225", |
| 9298 | "sqcap;": "\u2293", |
| 9299 | "sqcaps;": "\u2293\uFE00", |
| 9300 | "sqcup;": "\u2294", |
| 9301 | "sqcups;": "\u2294\uFE00", |
| 9302 | "Sqrt;": "\u221A", |
| 9303 | "sqsub;": "\u228F", |
| 9304 | "sqsube;": "\u2291", |
| 9305 | "sqsubset;": "\u228F", |
| 9306 | "sqsubseteq;": "\u2291", |
| 9307 | "sqsup;": "\u2290", |
| 9308 | "sqsupe;": "\u2292", |
| 9309 | "sqsupset;": "\u2290", |
| 9310 | "sqsupseteq;": "\u2292", |
| 9311 | "square;": "\u25A1", |
| 9312 | "Square;": "\u25A1", |
| 9313 | "SquareIntersection;": "\u2293", |
| 9314 | "SquareSubset;": "\u228F", |
| 9315 | "SquareSubsetEqual;": "\u2291", |
| 9316 | "SquareSuperset;": "\u2290", |
| 9317 | "SquareSupersetEqual;": "\u2292", |
| 9318 | "SquareUnion;": "\u2294", |
| 9319 | "squarf;": "\u25AA", |
| 9320 | "squ;": "\u25A1", |
| 9321 | "squf;": "\u25AA", |
| 9322 | "srarr;": "\u2192", |
| 9323 | "Sscr;": "\uD835\uDCAE", |
| 9324 | "sscr;": "\uD835\uDCC8", |
| 9325 | "ssetmn;": "\u2216", |
| 9326 | "ssmile;": "\u2323", |
| 9327 | "sstarf;": "\u22C6", |
| 9328 | "Star;": "\u22C6", |
| 9329 | "star;": "\u2606", |
| 9330 | "starf;": "\u2605", |
| 9331 | "straightepsilon;": "\u03F5", |
| 9332 | "straightphi;": "\u03D5", |
| 9333 | "strns;": "\u00AF", |
| 9334 | "sub;": "\u2282", |
| 9335 | "Sub;": "\u22D0", |
| 9336 | "subdot;": "\u2ABD", |
| 9337 | "subE;": "\u2AC5", |
| 9338 | "sube;": "\u2286", |
| 9339 | "subedot;": "\u2AC3", |
| 9340 | "submult;": "\u2AC1", |
| 9341 | "subnE;": "\u2ACB", |
| 9342 | "subne;": "\u228A", |
| 9343 | "subplus;": "\u2ABF", |
| 9344 | "subrarr;": "\u2979", |
| 9345 | "subset;": "\u2282", |
| 9346 | "Subset;": "\u22D0", |
| 9347 | "subseteq;": "\u2286", |
| 9348 | "subseteqq;": "\u2AC5", |
| 9349 | "SubsetEqual;": "\u2286", |
| 9350 | "subsetneq;": "\u228A", |
| 9351 | "subsetneqq;": "\u2ACB", |
| 9352 | "subsim;": "\u2AC7", |
| 9353 | "subsub;": "\u2AD5", |
| 9354 | "subsup;": "\u2AD3", |
| 9355 | "succapprox;": "\u2AB8", |
| 9356 | "succ;": "\u227B", |
| 9357 | "succcurlyeq;": "\u227D", |
| 9358 | "Succeeds;": "\u227B", |
| 9359 | "SucceedsEqual;": "\u2AB0", |
| 9360 | "SucceedsSlantEqual;": "\u227D", |
| 9361 | "SucceedsTilde;": "\u227F", |
| 9362 | "succeq;": "\u2AB0", |
| 9363 | "succnapprox;": "\u2ABA", |
| 9364 | "succneqq;": "\u2AB6", |
| 9365 | "succnsim;": "\u22E9", |
| 9366 | "succsim;": "\u227F", |
| 9367 | "SuchThat;": "\u220B", |
| 9368 | "sum;": "\u2211", |
| 9369 | "Sum;": "\u2211", |
| 9370 | "sung;": "\u266A", |
| 9371 | "sup1;": "\u00B9", |
| 9372 | "sup1": "\u00B9", |
| 9373 | "sup2;": "\u00B2", |
| 9374 | "sup2": "\u00B2", |
| 9375 | "sup3;": "\u00B3", |
| 9376 | "sup3": "\u00B3", |
| 9377 | "sup;": "\u2283", |
| 9378 | "Sup;": "\u22D1", |
| 9379 | "supdot;": "\u2ABE", |
| 9380 | "supdsub;": "\u2AD8", |
| 9381 | "supE;": "\u2AC6", |
| 9382 | "supe;": "\u2287", |
| 9383 | "supedot;": "\u2AC4", |
| 9384 | "Superset;": "\u2283", |
| 9385 | "SupersetEqual;": "\u2287", |
| 9386 | "suphsol;": "\u27C9", |
| 9387 | "suphsub;": "\u2AD7", |
| 9388 | "suplarr;": "\u297B", |
| 9389 | "supmult;": "\u2AC2", |
| 9390 | "supnE;": "\u2ACC", |
| 9391 | "supne;": "\u228B", |
| 9392 | "supplus;": "\u2AC0", |
| 9393 | "supset;": "\u2283", |
| 9394 | "Supset;": "\u22D1", |
| 9395 | "supseteq;": "\u2287", |
| 9396 | "supseteqq;": "\u2AC6", |
| 9397 | "supsetneq;": "\u228B", |
| 9398 | "supsetneqq;": "\u2ACC", |
| 9399 | "supsim;": "\u2AC8", |
| 9400 | "supsub;": "\u2AD4", |
| 9401 | "supsup;": "\u2AD6", |
| 9402 | "swarhk;": "\u2926", |
| 9403 | "swarr;": "\u2199", |
| 9404 | "swArr;": "\u21D9", |
| 9405 | "swarrow;": "\u2199", |
| 9406 | "swnwar;": "\u292A", |
| 9407 | "szlig;": "\u00DF", |
| 9408 | "szlig": "\u00DF", |
| 9409 | "Tab;": "\u0009", |
| 9410 | "target;": "\u2316", |
| 9411 | "Tau;": "\u03A4", |
| 9412 | "tau;": "\u03C4", |
| 9413 | "tbrk;": "\u23B4", |
| 9414 | "Tcaron;": "\u0164", |
| 9415 | "tcaron;": "\u0165", |
| 9416 | "Tcedil;": "\u0162", |
| 9417 | "tcedil;": "\u0163", |
| 9418 | "Tcy;": "\u0422", |
| 9419 | "tcy;": "\u0442", |
| 9420 | "tdot;": "\u20DB", |
| 9421 | "telrec;": "\u2315", |
| 9422 | "Tfr;": "\uD835\uDD17", |
| 9423 | "tfr;": "\uD835\uDD31", |
| 9424 | "there4;": "\u2234", |
| 9425 | "therefore;": "\u2234", |
| 9426 | "Therefore;": "\u2234", |
| 9427 | "Theta;": "\u0398", |
| 9428 | "theta;": "\u03B8", |
| 9429 | "thetasym;": "\u03D1", |
| 9430 | "thetav;": "\u03D1", |
| 9431 | "thickapprox;": "\u2248", |
| 9432 | "thicksim;": "\u223C", |
| 9433 | "ThickSpace;": "\u205F\u200A", |
| 9434 | "ThinSpace;": "\u2009", |
| 9435 | "thinsp;": "\u2009", |
| 9436 | "thkap;": "\u2248", |
| 9437 | "thksim;": "\u223C", |
| 9438 | "THORN;": "\u00DE", |
| 9439 | "THORN": "\u00DE", |
| 9440 | "thorn;": "\u00FE", |
| 9441 | "thorn": "\u00FE", |
| 9442 | "tilde;": "\u02DC", |
| 9443 | "Tilde;": "\u223C", |
| 9444 | "TildeEqual;": "\u2243", |
| 9445 | "TildeFullEqual;": "\u2245", |
| 9446 | "TildeTilde;": "\u2248", |
| 9447 | "timesbar;": "\u2A31", |
| 9448 | "timesb;": "\u22A0", |
| 9449 | "times;": "\u00D7", |
| 9450 | "times": "\u00D7", |
| 9451 | "timesd;": "\u2A30", |
| 9452 | "tint;": "\u222D", |
| 9453 | "toea;": "\u2928", |
| 9454 | "topbot;": "\u2336", |
| 9455 | "topcir;": "\u2AF1", |
| 9456 | "top;": "\u22A4", |
| 9457 | "Topf;": "\uD835\uDD4B", |
| 9458 | "topf;": "\uD835\uDD65", |
| 9459 | "topfork;": "\u2ADA", |
| 9460 | "tosa;": "\u2929", |
| 9461 | "tprime;": "\u2034", |
| 9462 | "trade;": "\u2122", |
| 9463 | "TRADE;": "\u2122", |
| 9464 | "triangle;": "\u25B5", |
| 9465 | "triangledown;": "\u25BF", |
| 9466 | "triangleleft;": "\u25C3", |
| 9467 | "trianglelefteq;": "\u22B4", |
| 9468 | "triangleq;": "\u225C", |
| 9469 | "triangleright;": "\u25B9", |
| 9470 | "trianglerighteq;": "\u22B5", |
| 9471 | "tridot;": "\u25EC", |
| 9472 | "trie;": "\u225C", |
| 9473 | "triminus;": "\u2A3A", |
| 9474 | "TripleDot;": "\u20DB", |
| 9475 | "triplus;": "\u2A39", |
| 9476 | "trisb;": "\u29CD", |
| 9477 | "tritime;": "\u2A3B", |
| 9478 | "trpezium;": "\u23E2", |
| 9479 | "Tscr;": "\uD835\uDCAF", |
| 9480 | "tscr;": "\uD835\uDCC9", |
| 9481 | "TScy;": "\u0426", |
| 9482 | "tscy;": "\u0446", |
| 9483 | "TSHcy;": "\u040B", |
| 9484 | "tshcy;": "\u045B", |
| 9485 | "Tstrok;": "\u0166", |
| 9486 | "tstrok;": "\u0167", |
| 9487 | "twixt;": "\u226C", |
| 9488 | "twoheadleftarrow;": "\u219E", |
| 9489 | "twoheadrightarrow;": "\u21A0", |
| 9490 | "Uacute;": "\u00DA", |
| 9491 | "Uacute": "\u00DA", |
| 9492 | "uacute;": "\u00FA", |
| 9493 | "uacute": "\u00FA", |
| 9494 | "uarr;": "\u2191", |
| 9495 | "Uarr;": "\u219F", |
| 9496 | "uArr;": "\u21D1", |
| 9497 | "Uarrocir;": "\u2949", |
| 9498 | "Ubrcy;": "\u040E", |
| 9499 | "ubrcy;": "\u045E", |
| 9500 | "Ubreve;": "\u016C", |
| 9501 | "ubreve;": "\u016D", |
| 9502 | "Ucirc;": "\u00DB", |
| 9503 | "Ucirc": "\u00DB", |
| 9504 | "ucirc;": "\u00FB", |
| 9505 | "ucirc": "\u00FB", |
| 9506 | "Ucy;": "\u0423", |
| 9507 | "ucy;": "\u0443", |
| 9508 | "udarr;": "\u21C5", |
| 9509 | "Udblac;": "\u0170", |
| 9510 | "udblac;": "\u0171", |
| 9511 | "udhar;": "\u296E", |
| 9512 | "ufisht;": "\u297E", |
| 9513 | "Ufr;": "\uD835\uDD18", |
| 9514 | "ufr;": "\uD835\uDD32", |
| 9515 | "Ugrave;": "\u00D9", |
| 9516 | "Ugrave": "\u00D9", |
| 9517 | "ugrave;": "\u00F9", |
| 9518 | "ugrave": "\u00F9", |
| 9519 | "uHar;": "\u2963", |
| 9520 | "uharl;": "\u21BF", |
| 9521 | "uharr;": "\u21BE", |
| 9522 | "uhblk;": "\u2580", |
| 9523 | "ulcorn;": "\u231C", |
| 9524 | "ulcorner;": "\u231C", |
| 9525 | "ulcrop;": "\u230F", |
| 9526 | "ultri;": "\u25F8", |
| 9527 | "Umacr;": "\u016A", |
| 9528 | "umacr;": "\u016B", |
| 9529 | "uml;": "\u00A8", |
| 9530 | "uml": "\u00A8", |
| 9531 | "UnderBar;": "\u005F", |
| 9532 | "UnderBrace;": "\u23DF", |
| 9533 | "UnderBracket;": "\u23B5", |
| 9534 | "UnderParenthesis;": "\u23DD", |
| 9535 | "Union;": "\u22C3", |
| 9536 | "UnionPlus;": "\u228E", |
| 9537 | "Uogon;": "\u0172", |
| 9538 | "uogon;": "\u0173", |
| 9539 | "Uopf;": "\uD835\uDD4C", |
| 9540 | "uopf;": "\uD835\uDD66", |
| 9541 | "UpArrowBar;": "\u2912", |
| 9542 | "uparrow;": "\u2191", |
| 9543 | "UpArrow;": "\u2191", |
| 9544 | "Uparrow;": "\u21D1", |
| 9545 | "UpArrowDownArrow;": "\u21C5", |
| 9546 | "updownarrow;": "\u2195", |
| 9547 | "UpDownArrow;": "\u2195", |
| 9548 | "Updownarrow;": "\u21D5", |
| 9549 | "UpEquilibrium;": "\u296E", |
| 9550 | "upharpoonleft;": "\u21BF", |
| 9551 | "upharpoonright;": "\u21BE", |
| 9552 | "uplus;": "\u228E", |
| 9553 | "UpperLeftArrow;": "\u2196", |
| 9554 | "UpperRightArrow;": "\u2197", |
| 9555 | "upsi;": "\u03C5", |
| 9556 | "Upsi;": "\u03D2", |
| 9557 | "upsih;": "\u03D2", |
| 9558 | "Upsilon;": "\u03A5", |
| 9559 | "upsilon;": "\u03C5", |
| 9560 | "UpTeeArrow;": "\u21A5", |
| 9561 | "UpTee;": "\u22A5", |
| 9562 | "upuparrows;": "\u21C8", |
| 9563 | "urcorn;": "\u231D", |
| 9564 | "urcorner;": "\u231D", |
| 9565 | "urcrop;": "\u230E", |
| 9566 | "Uring;": "\u016E", |
| 9567 | "uring;": "\u016F", |
| 9568 | "urtri;": "\u25F9", |
| 9569 | "Uscr;": "\uD835\uDCB0", |
| 9570 | "uscr;": "\uD835\uDCCA", |
| 9571 | "utdot;": "\u22F0", |
| 9572 | "Utilde;": "\u0168", |
| 9573 | "utilde;": "\u0169", |
| 9574 | "utri;": "\u25B5", |
| 9575 | "utrif;": "\u25B4", |
| 9576 | "uuarr;": "\u21C8", |
| 9577 | "Uuml;": "\u00DC", |
| 9578 | "Uuml": "\u00DC", |
| 9579 | "uuml;": "\u00FC", |
| 9580 | "uuml": "\u00FC", |
| 9581 | "uwangle;": "\u29A7", |
| 9582 | "vangrt;": "\u299C", |
| 9583 | "varepsilon;": "\u03F5", |
| 9584 | "varkappa;": "\u03F0", |
| 9585 | "varnothing;": "\u2205", |
| 9586 | "varphi;": "\u03D5", |
| 9587 | "varpi;": "\u03D6", |
| 9588 | "varpropto;": "\u221D", |
| 9589 | "varr;": "\u2195", |
| 9590 | "vArr;": "\u21D5", |
| 9591 | "varrho;": "\u03F1", |
| 9592 | "varsigma;": "\u03C2", |
| 9593 | "varsubsetneq;": "\u228A\uFE00", |
| 9594 | "varsubsetneqq;": "\u2ACB\uFE00", |
| 9595 | "varsupsetneq;": "\u228B\uFE00", |
| 9596 | "varsupsetneqq;": "\u2ACC\uFE00", |
| 9597 | "vartheta;": "\u03D1", |
| 9598 | "vartriangleleft;": "\u22B2", |
| 9599 | "vartriangleright;": "\u22B3", |
| 9600 | "vBar;": "\u2AE8", |
| 9601 | "Vbar;": "\u2AEB", |
| 9602 | "vBarv;": "\u2AE9", |
| 9603 | "Vcy;": "\u0412", |
| 9604 | "vcy;": "\u0432", |
| 9605 | "vdash;": "\u22A2", |
| 9606 | "vDash;": "\u22A8", |
| 9607 | "Vdash;": "\u22A9", |
| 9608 | "VDash;": "\u22AB", |
| 9609 | "Vdashl;": "\u2AE6", |
| 9610 | "veebar;": "\u22BB", |
| 9611 | "vee;": "\u2228", |
| 9612 | "Vee;": "\u22C1", |
| 9613 | "veeeq;": "\u225A", |
| 9614 | "vellip;": "\u22EE", |
| 9615 | "verbar;": "\u007C", |
| 9616 | "Verbar;": "\u2016", |
| 9617 | "vert;": "\u007C", |
| 9618 | "Vert;": "\u2016", |
| 9619 | "VerticalBar;": "\u2223", |
| 9620 | "VerticalLine;": "\u007C", |
| 9621 | "VerticalSeparator;": "\u2758", |
| 9622 | "VerticalTilde;": "\u2240", |
| 9623 | "VeryThinSpace;": "\u200A", |
| 9624 | "Vfr;": "\uD835\uDD19", |
| 9625 | "vfr;": "\uD835\uDD33", |
| 9626 | "vltri;": "\u22B2", |
| 9627 | "vnsub;": "\u2282\u20D2", |
| 9628 | "vnsup;": "\u2283\u20D2", |
| 9629 | "Vopf;": "\uD835\uDD4D", |
| 9630 | "vopf;": "\uD835\uDD67", |
| 9631 | "vprop;": "\u221D", |
| 9632 | "vrtri;": "\u22B3", |
| 9633 | "Vscr;": "\uD835\uDCB1", |
| 9634 | "vscr;": "\uD835\uDCCB", |
| 9635 | "vsubnE;": "\u2ACB\uFE00", |
| 9636 | "vsubne;": "\u228A\uFE00", |
| 9637 | "vsupnE;": "\u2ACC\uFE00", |
| 9638 | "vsupne;": "\u228B\uFE00", |
| 9639 | "Vvdash;": "\u22AA", |
| 9640 | "vzigzag;": "\u299A", |
| 9641 | "Wcirc;": "\u0174", |
| 9642 | "wcirc;": "\u0175", |
| 9643 | "wedbar;": "\u2A5F", |
| 9644 | "wedge;": "\u2227", |
| 9645 | "Wedge;": "\u22C0", |
| 9646 | "wedgeq;": "\u2259", |
| 9647 | "weierp;": "\u2118", |
| 9648 | "Wfr;": "\uD835\uDD1A", |
| 9649 | "wfr;": "\uD835\uDD34", |
| 9650 | "Wopf;": "\uD835\uDD4E", |
| 9651 | "wopf;": "\uD835\uDD68", |
| 9652 | "wp;": "\u2118", |
| 9653 | "wr;": "\u2240", |
| 9654 | "wreath;": "\u2240", |
| 9655 | "Wscr;": "\uD835\uDCB2", |
| 9656 | "wscr;": "\uD835\uDCCC", |
| 9657 | "xcap;": "\u22C2", |
| 9658 | "xcirc;": "\u25EF", |
| 9659 | "xcup;": "\u22C3", |
| 9660 | "xdtri;": "\u25BD", |
| 9661 | "Xfr;": "\uD835\uDD1B", |
| 9662 | "xfr;": "\uD835\uDD35", |
| 9663 | "xharr;": "\u27F7", |
| 9664 | "xhArr;": "\u27FA", |
| 9665 | "Xi;": "\u039E", |
| 9666 | "xi;": "\u03BE", |
| 9667 | "xlarr;": "\u27F5", |
| 9668 | "xlArr;": "\u27F8", |
| 9669 | "xmap;": "\u27FC", |
| 9670 | "xnis;": "\u22FB", |
| 9671 | "xodot;": "\u2A00", |
| 9672 | "Xopf;": "\uD835\uDD4F", |
| 9673 | "xopf;": "\uD835\uDD69", |
| 9674 | "xoplus;": "\u2A01", |
| 9675 | "xotime;": "\u2A02", |
| 9676 | "xrarr;": "\u27F6", |
| 9677 | "xrArr;": "\u27F9", |
| 9678 | "Xscr;": "\uD835\uDCB3", |
| 9679 | "xscr;": "\uD835\uDCCD", |
| 9680 | "xsqcup;": "\u2A06", |
| 9681 | "xuplus;": "\u2A04", |
| 9682 | "xutri;": "\u25B3", |
| 9683 | "xvee;": "\u22C1", |
| 9684 | "xwedge;": "\u22C0", |
| 9685 | "Yacute;": "\u00DD", |
| 9686 | "Yacute": "\u00DD", |
| 9687 | "yacute;": "\u00FD", |
| 9688 | "yacute": "\u00FD", |
| 9689 | "YAcy;": "\u042F", |
| 9690 | "yacy;": "\u044F", |
| 9691 | "Ycirc;": "\u0176", |
| 9692 | "ycirc;": "\u0177", |
| 9693 | "Ycy;": "\u042B", |
| 9694 | "ycy;": "\u044B", |
| 9695 | "yen;": "\u00A5", |
| 9696 | "yen": "\u00A5", |
| 9697 | "Yfr;": "\uD835\uDD1C", |
| 9698 | "yfr;": "\uD835\uDD36", |
| 9699 | "YIcy;": "\u0407", |
| 9700 | "yicy;": "\u0457", |
| 9701 | "Yopf;": "\uD835\uDD50", |
| 9702 | "yopf;": "\uD835\uDD6A", |
| 9703 | "Yscr;": "\uD835\uDCB4", |
| 9704 | "yscr;": "\uD835\uDCCE", |
| 9705 | "YUcy;": "\u042E", |
| 9706 | "yucy;": "\u044E", |
| 9707 | "yuml;": "\u00FF", |
| 9708 | "yuml": "\u00FF", |
| 9709 | "Yuml;": "\u0178", |
| 9710 | "Zacute;": "\u0179", |
| 9711 | "zacute;": "\u017A", |
| 9712 | "Zcaron;": "\u017D", |
| 9713 | "zcaron;": "\u017E", |
| 9714 | "Zcy;": "\u0417", |
| 9715 | "zcy;": "\u0437", |
| 9716 | "Zdot;": "\u017B", |
| 9717 | "zdot;": "\u017C", |
| 9718 | "zeetrf;": "\u2128", |
| 9719 | "ZeroWidthSpace;": "\u200B", |
| 9720 | "Zeta;": "\u0396", |
| 9721 | "zeta;": "\u03B6", |
| 9722 | "zfr;": "\uD835\uDD37", |
| 9723 | "Zfr;": "\u2128", |
| 9724 | "ZHcy;": "\u0416", |
| 9725 | "zhcy;": "\u0436", |
| 9726 | "zigrarr;": "\u21DD", |
| 9727 | "zopf;": "\uD835\uDD6B", |
| 9728 | "Zopf;": "\u2124", |
| 9729 | "Zscr;": "\uD835\uDCB5", |
| 9730 | "zscr;": "\uD835\uDCCF", |
| 9731 | "zwj;": "\u200D", |
| 9732 | "zwnj;": "\u200C" |
| 9733 | }; |
| 9734 | |
| 9735 | }, |
| 9736 | {}], |
| 9737 | 13:[function(_dereq_,module,exports){ |
| 9738 | var util = _dereq_('util/'); |
| 9739 | |
| 9740 | var pSlice = Array.prototype.slice; |
| 9741 | var hasOwn = Object.prototype.hasOwnProperty; |
| 9742 | |
| 9743 | var assert = module.exports = ok; |
| 9744 | |
| 9745 | assert.AssertionError = function AssertionError(options) { |
| 9746 | this.name = 'AssertionError'; |
| 9747 | this.actual = options.actual; |
| 9748 | this.expected = options.expected; |
| 9749 | this.operator = options.operator; |
| 9750 | if (options.message) { |
| 9751 | this.message = options.message; |
| 9752 | this.generatedMessage = false; |
| 9753 | } else { |
| 9754 | this.message = getMessage(this); |
| 9755 | this.generatedMessage = true; |
| 9756 | } |
| 9757 | var stackStartFunction = options.stackStartFunction || fail; |
| 9758 | |
| 9759 | if (Error.captureStackTrace) { |
| 9760 | Error.captureStackTrace(this, stackStartFunction); |
| 9761 | } |
| 9762 | else { |
| 9763 | var err = new Error(); |
| 9764 | if (err.stack) { |
| 9765 | var out = err.stack; |
| 9766 | var fn_name = stackStartFunction.name; |
| 9767 | var idx = out.indexOf('\n' + fn_name); |
| 9768 | if (idx >= 0) { |
| 9769 | var next_line = out.indexOf('\n', idx + 1); |
| 9770 | out = out.substring(next_line + 1); |
| 9771 | } |
| 9772 | |
| 9773 | this.stack = out; |
| 9774 | } |
| 9775 | } |
| 9776 | }; |
| 9777 | util.inherits(assert.AssertionError, Error); |
| 9778 | |
| 9779 | function replacer(key, value) { |
| 9780 | if (util.isUndefined(value)) { |
| 9781 | return '' + value; |
| 9782 | } |
| 9783 | if (util.isNumber(value) && (isNaN(value) || !isFinite(value))) { |
| 9784 | return value.toString(); |
| 9785 | } |
| 9786 | if (util.isFunction(value) || util.isRegExp(value)) { |
| 9787 | return value.toString(); |
| 9788 | } |
| 9789 | return value; |
| 9790 | } |
| 9791 | |
| 9792 | function truncate(s, n) { |
| 9793 | if (util.isString(s)) { |
| 9794 | return s.length < n ? s : s.slice(0, n); |
| 9795 | } else { |
| 9796 | return s; |
| 9797 | } |
| 9798 | } |
| 9799 | |
| 9800 | function getMessage(self) { |
| 9801 | return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' + |
| 9802 | self.operator + ' ' + |
| 9803 | truncate(JSON.stringify(self.expected, replacer), 128); |
| 9804 | } |
| 9805 | |
| 9806 | function fail(actual, expected, message, operator, stackStartFunction) { |
| 9807 | throw new assert.AssertionError({ |
| 9808 | message: message, |
| 9809 | actual: actual, |
| 9810 | expected: expected, |
| 9811 | operator: operator, |
| 9812 | stackStartFunction: stackStartFunction |
| 9813 | }); |
| 9814 | } |
| 9815 | assert.fail = fail; |
| 9816 | |
| 9817 | function ok(value, message) { |
| 9818 | if (!value) fail(value, true, message, '==', assert.ok); |
| 9819 | } |
| 9820 | assert.ok = ok; |
| 9821 | |
| 9822 | assert.equal = function equal(actual, expected, message) { |
| 9823 | if (actual != expected) fail(actual, expected, message, '==', assert.equal); |
| 9824 | }; |
| 9825 | |
| 9826 | assert.notEqual = function notEqual(actual, expected, message) { |
| 9827 | if (actual == expected) { |
| 9828 | fail(actual, expected, message, '!=', assert.notEqual); |
| 9829 | } |
| 9830 | }; |
| 9831 | |
| 9832 | assert.deepEqual = function deepEqual(actual, expected, message) { |
| 9833 | if (!_deepEqual(actual, expected)) { |
| 9834 | fail(actual, expected, message, 'deepEqual', assert.deepEqual); |
| 9835 | } |
| 9836 | }; |
| 9837 | |
| 9838 | function _deepEqual(actual, expected) { |
| 9839 | if (actual === expected) { |
| 9840 | return true; |
| 9841 | |
| 9842 | } else if (util.isBuffer(actual) && util.isBuffer(expected)) { |
| 9843 | if (actual.length != expected.length) return false; |
| 9844 | |
| 9845 | for (var i = 0; i < actual.length; i++) { |
| 9846 | if (actual[i] !== expected[i]) return false; |
| 9847 | } |
| 9848 | |
| 9849 | return true; |
| 9850 | } else if (util.isDate(actual) && util.isDate(expected)) { |
| 9851 | return actual.getTime() === expected.getTime(); |
| 9852 | } else if (util.isRegExp(actual) && util.isRegExp(expected)) { |
| 9853 | return actual.source === expected.source && |
| 9854 | actual.global === expected.global && |
| 9855 | actual.multiline === expected.multiline && |
| 9856 | actual.lastIndex === expected.lastIndex && |
| 9857 | actual.ignoreCase === expected.ignoreCase; |
| 9858 | } else if (!util.isObject(actual) && !util.isObject(expected)) { |
| 9859 | return actual == expected; |
| 9860 | } else { |
| 9861 | return objEquiv(actual, expected); |
| 9862 | } |
| 9863 | } |
| 9864 | |
| 9865 | function isArguments(object) { |
| 9866 | return Object.prototype.toString.call(object) == '[object Arguments]'; |
| 9867 | } |
| 9868 | |
| 9869 | function objEquiv(a, b) { |
| 9870 | if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b)) |
| 9871 | return false; |
| 9872 | if (a.prototype !== b.prototype) return false; |
| 9873 | if (isArguments(a)) { |
| 9874 | if (!isArguments(b)) { |
| 9875 | return false; |
| 9876 | } |
| 9877 | a = pSlice.call(a); |
| 9878 | b = pSlice.call(b); |
| 9879 | return _deepEqual(a, b); |
| 9880 | } |
| 9881 | try { |
| 9882 | var ka = objectKeys(a), |
| 9883 | kb = objectKeys(b), |
| 9884 | key, i; |
| 9885 | } catch (e) {//happens when one is a string literal and the other isn't |
| 9886 | return false; |
| 9887 | } |
| 9888 | if (ka.length != kb.length) |
| 9889 | return false; |
| 9890 | ka.sort(); |
| 9891 | kb.sort(); |
| 9892 | for (i = ka.length - 1; i >= 0; i--) { |
| 9893 | if (ka[i] != kb[i]) |
| 9894 | return false; |
| 9895 | } |
| 9896 | for (i = ka.length - 1; i >= 0; i--) { |
| 9897 | key = ka[i]; |
| 9898 | if (!_deepEqual(a[key], b[key])) return false; |
| 9899 | } |
| 9900 | return true; |
| 9901 | } |
| 9902 | |
| 9903 | assert.notDeepEqual = function notDeepEqual(actual, expected, message) { |
| 9904 | if (_deepEqual(actual, expected)) { |
| 9905 | fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); |
| 9906 | } |
| 9907 | }; |
| 9908 | |
| 9909 | assert.strictEqual = function strictEqual(actual, expected, message) { |
| 9910 | if (actual !== expected) { |
| 9911 | fail(actual, expected, message, '===', assert.strictEqual); |
| 9912 | } |
| 9913 | }; |
| 9914 | |
| 9915 | assert.notStrictEqual = function notStrictEqual(actual, expected, message) { |
| 9916 | if (actual === expected) { |
| 9917 | fail(actual, expected, message, '!==', assert.notStrictEqual); |
| 9918 | } |
| 9919 | }; |
| 9920 | |
| 9921 | function expectedException(actual, expected) { |
| 9922 | if (!actual || !expected) { |
| 9923 | return false; |
| 9924 | } |
| 9925 | |
| 9926 | if (Object.prototype.toString.call(expected) == '[object RegExp]') { |
| 9927 | return expected.test(actual); |
| 9928 | } else if (actual instanceof expected) { |
| 9929 | return true; |
| 9930 | } else if (expected.call({}, actual) === true) { |
| 9931 | return true; |
| 9932 | } |
| 9933 | |
| 9934 | return false; |
| 9935 | } |
| 9936 | |
| 9937 | function _throws(shouldThrow, block, expected, message) { |
| 9938 | var actual; |
| 9939 | |
| 9940 | if (util.isString(expected)) { |
| 9941 | message = expected; |
| 9942 | expected = null; |
| 9943 | } |
| 9944 | |
| 9945 | try { |
| 9946 | block(); |
| 9947 | } catch (e) { |
| 9948 | actual = e; |
| 9949 | } |
| 9950 | |
| 9951 | message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + |
| 9952 | (message ? ' ' + message : '.'); |
| 9953 | |
| 9954 | if (shouldThrow && !actual) { |
| 9955 | fail(actual, expected, 'Missing expected exception' + message); |
| 9956 | } |
| 9957 | |
| 9958 | if (!shouldThrow && expectedException(actual, expected)) { |
| 9959 | fail(actual, expected, 'Got unwanted exception' + message); |
| 9960 | } |
| 9961 | |
| 9962 | if ((shouldThrow && actual && expected && |
| 9963 | !expectedException(actual, expected)) || (!shouldThrow && actual)) { |
| 9964 | throw actual; |
| 9965 | } |
| 9966 | } |
| 9967 | |
| 9968 | assert.throws = function(block, /*optional*/error, /*optional*/message) { |
| 9969 | _throws.apply(this, [true].concat(pSlice.call(arguments))); |
| 9970 | }; |
| 9971 | assert.doesNotThrow = function(block, /*optional*/message) { |
| 9972 | _throws.apply(this, [false].concat(pSlice.call(arguments))); |
| 9973 | }; |
| 9974 | |
| 9975 | assert.ifError = function(err) { if (err) {throw err;}}; |
| 9976 | |
| 9977 | var objectKeys = Object.keys || function (obj) { |
| 9978 | var keys = []; |
| 9979 | for (var key in obj) { |
| 9980 | if (hasOwn.call(obj, key)) keys.push(key); |
| 9981 | } |
| 9982 | return keys; |
| 9983 | }; |
| 9984 | |
| 9985 | }, |
| 9986 | {"util/":15}], |
| 9987 | 14:[function(_dereq_,module,exports){ |
| 9988 | module.exports = function isBuffer(arg) { |
| 9989 | return arg && typeof arg === 'object' |
| 9990 | && typeof arg.copy === 'function' |
| 9991 | && typeof arg.fill === 'function' |
| 9992 | && typeof arg.readUInt8 === 'function'; |
| 9993 | } |
| 9994 | }, |
| 9995 | {}], |
| 9996 | 15:[function(_dereq_,module,exports){ |
| 9997 | (function (process,global){ |
| 9998 | |
| 9999 | var formatRegExp = /%[sdj%]/g; |
| 10000 | exports.format = function(f) { |
| 10001 | if (!isString(f)) { |
| 10002 | var objects = []; |
| 10003 | for (var i = 0; i < arguments.length; i++) { |
| 10004 | objects.push(inspect(arguments[i])); |
| 10005 | } |
| 10006 | return objects.join(' '); |
| 10007 | } |
| 10008 | |
| 10009 | var i = 1; |
| 10010 | var args = arguments; |
| 10011 | var len = args.length; |
| 10012 | var str = String(f).replace(formatRegExp, function(x) { |
| 10013 | if (x === '%%') return '%'; |
| 10014 | if (i >= len) return x; |
| 10015 | switch (x) { |
| 10016 | case '%s': return String(args[i++]); |
| 10017 | case '%d': return Number(args[i++]); |
| 10018 | case '%j': |
| 10019 | try { |
| 10020 | return JSON.stringify(args[i++]); |
| 10021 | } catch (_) { |
| 10022 | return '[Circular]'; |
| 10023 | } |
| 10024 | default: |
| 10025 | return x; |
| 10026 | } |
| 10027 | }); |
| 10028 | for (var x = args[i]; i < len; x = args[++i]) { |
| 10029 | if (isNull(x) || !isObject(x)) { |
| 10030 | str += ' ' + x; |
| 10031 | } else { |
| 10032 | str += ' ' + inspect(x); |
| 10033 | } |
| 10034 | } |
| 10035 | return str; |
| 10036 | }; |
| 10037 | exports.deprecate = function(fn, msg) { |
| 10038 | if (isUndefined(global.process)) { |
| 10039 | return function() { |
| 10040 | return exports.deprecate(fn, msg).apply(this, arguments); |
| 10041 | }; |
| 10042 | } |
| 10043 | |
| 10044 | if (process.noDeprecation === true) { |
| 10045 | return fn; |
| 10046 | } |
| 10047 | |
| 10048 | var warned = false; |
| 10049 | function deprecated() { |
| 10050 | if (!warned) { |
| 10051 | if (process.throwDeprecation) { |
| 10052 | throw new Error(msg); |
| 10053 | } else if (process.traceDeprecation) { |
| 10054 | console.trace(msg); |
| 10055 | } else { |
| 10056 | console.error(msg); |
| 10057 | } |
| 10058 | warned = true; |
| 10059 | } |
| 10060 | return fn.apply(this, arguments); |
| 10061 | } |
| 10062 | |
| 10063 | return deprecated; |
| 10064 | }; |
| 10065 | |
| 10066 | |
| 10067 | var debugs = {}; |
| 10068 | var debugEnviron; |
| 10069 | exports.debuglog = function(set) { |
| 10070 | if (isUndefined(debugEnviron)) |
| 10071 | debugEnviron = process.env.NODE_DEBUG || ''; |
| 10072 | set = set.toUpperCase(); |
| 10073 | if (!debugs[set]) { |
| 10074 | if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { |
| 10075 | var pid = process.pid; |
| 10076 | debugs[set] = function() { |
| 10077 | var msg = exports.format.apply(exports, arguments); |
| 10078 | console.error('%s %d: %s', set, pid, msg); |
| 10079 | }; |
| 10080 | } else { |
| 10081 | debugs[set] = function() {}; |
| 10082 | } |
| 10083 | } |
| 10084 | return debugs[set]; |
| 10085 | }; |
| 10086 | function inspect(obj, opts) { |
| 10087 | var ctx = { |
| 10088 | seen: [], |
| 10089 | stylize: stylizeNoColor |
| 10090 | }; |
| 10091 | if (arguments.length >= 3) ctx.depth = arguments[2]; |
| 10092 | if (arguments.length >= 4) ctx.colors = arguments[3]; |
| 10093 | if (isBoolean(opts)) { |
| 10094 | ctx.showHidden = opts; |
| 10095 | } else if (opts) { |
| 10096 | exports._extend(ctx, opts); |
| 10097 | } |
| 10098 | if (isUndefined(ctx.showHidden)) ctx.showHidden = false; |
| 10099 | if (isUndefined(ctx.depth)) ctx.depth = 2; |
| 10100 | if (isUndefined(ctx.colors)) ctx.colors = false; |
| 10101 | if (isUndefined(ctx.customInspect)) ctx.customInspect = true; |
| 10102 | if (ctx.colors) ctx.stylize = stylizeWithColor; |
| 10103 | return formatValue(ctx, obj, ctx.depth); |
| 10104 | } |
| 10105 | exports.inspect = inspect; |
| 10106 | inspect.colors = { |
| 10107 | 'bold' : [1, 22], |
| 10108 | 'italic' : [3, 23], |
| 10109 | 'underline' : [4, 24], |
| 10110 | 'inverse' : [7, 27], |
| 10111 | 'white' : [37, 39], |
| 10112 | 'grey' : [90, 39], |
| 10113 | 'black' : [30, 39], |
| 10114 | 'blue' : [34, 39], |
| 10115 | 'cyan' : [36, 39], |
| 10116 | 'green' : [32, 39], |
| 10117 | 'magenta' : [35, 39], |
| 10118 | 'red' : [31, 39], |
| 10119 | 'yellow' : [33, 39] |
| 10120 | }; |
| 10121 | inspect.styles = { |
| 10122 | 'special': 'cyan', |
| 10123 | 'number': 'yellow', |
| 10124 | 'boolean': 'yellow', |
| 10125 | 'undefined': 'grey', |
| 10126 | 'null': 'bold', |
| 10127 | 'string': 'green', |
| 10128 | 'date': 'magenta', |
| 10129 | 'regexp': 'red' |
| 10130 | }; |
| 10131 | |
| 10132 | |
| 10133 | function stylizeWithColor(str, styleType) { |
| 10134 | var style = inspect.styles[styleType]; |
| 10135 | |
| 10136 | if (style) { |
| 10137 | return '\u001b[' + inspect.colors[style][0] + 'm' + str + |
| 10138 | '\u001b[' + inspect.colors[style][1] + 'm'; |
| 10139 | } else { |
| 10140 | return str; |
| 10141 | } |
| 10142 | } |
| 10143 | |
| 10144 | |
| 10145 | function stylizeNoColor(str, styleType) { |
| 10146 | return str; |
| 10147 | } |
| 10148 | |
| 10149 | |
| 10150 | function arrayToHash(array) { |
| 10151 | var hash = {}; |
| 10152 | |
| 10153 | array.forEach(function(val, idx) { |
| 10154 | hash[val] = true; |
| 10155 | }); |
| 10156 | |
| 10157 | return hash; |
| 10158 | } |
| 10159 | |
| 10160 | |
| 10161 | function formatValue(ctx, value, recurseTimes) { |
| 10162 | if (ctx.customInspect && |
| 10163 | value && |
| 10164 | isFunction(value.inspect) && |
| 10165 | value.inspect !== exports.inspect && |
| 10166 | !(value.constructor && value.constructor.prototype === value)) { |
| 10167 | var ret = value.inspect(recurseTimes, ctx); |
| 10168 | if (!isString(ret)) { |
| 10169 | ret = formatValue(ctx, ret, recurseTimes); |
| 10170 | } |
| 10171 | return ret; |
| 10172 | } |
| 10173 | var primitive = formatPrimitive(ctx, value); |
| 10174 | if (primitive) { |
| 10175 | return primitive; |
| 10176 | } |
| 10177 | var keys = Object.keys(value); |
| 10178 | var visibleKeys = arrayToHash(keys); |
| 10179 | |
| 10180 | if (ctx.showHidden) { |
| 10181 | keys = Object.getOwnPropertyNames(value); |
| 10182 | } |
| 10183 | if (isError(value) |
| 10184 | && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { |
| 10185 | return formatError(value); |
| 10186 | } |
| 10187 | if (keys.length === 0) { |
| 10188 | if (isFunction(value)) { |
| 10189 | var name = value.name ? ': ' + value.name : ''; |
| 10190 | return ctx.stylize('[Function' + name + ']', 'special'); |
| 10191 | } |
| 10192 | if (isRegExp(value)) { |
| 10193 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); |
| 10194 | } |
| 10195 | if (isDate(value)) { |
| 10196 | return ctx.stylize(Date.prototype.toString.call(value), 'date'); |
| 10197 | } |
| 10198 | if (isError(value)) { |
| 10199 | return formatError(value); |
| 10200 | } |
| 10201 | } |
| 10202 | |
| 10203 | var base = '', array = false, braces = ['{', '}']; |
| 10204 | if (isArray(value)) { |
| 10205 | array = true; |
| 10206 | braces = ['[', ']']; |
| 10207 | } |
| 10208 | if (isFunction(value)) { |
| 10209 | var n = value.name ? ': ' + value.name : ''; |
| 10210 | base = ' [Function' + n + ']'; |
| 10211 | } |
| 10212 | if (isRegExp(value)) { |
| 10213 | base = ' ' + RegExp.prototype.toString.call(value); |
| 10214 | } |
| 10215 | if (isDate(value)) { |
| 10216 | base = ' ' + Date.prototype.toUTCString.call(value); |
| 10217 | } |
| 10218 | if (isError(value)) { |
| 10219 | base = ' ' + formatError(value); |
| 10220 | } |
| 10221 | |
| 10222 | if (keys.length === 0 && (!array || value.length == 0)) { |
| 10223 | return braces[0] + base + braces[1]; |
| 10224 | } |
| 10225 | |
| 10226 | if (recurseTimes < 0) { |
| 10227 | if (isRegExp(value)) { |
| 10228 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); |
| 10229 | } else { |
| 10230 | return ctx.stylize('[Object]', 'special'); |
| 10231 | } |
| 10232 | } |
| 10233 | |
| 10234 | ctx.seen.push(value); |
| 10235 | |
| 10236 | var output; |
| 10237 | if (array) { |
| 10238 | output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); |
| 10239 | } else { |
| 10240 | output = keys.map(function(key) { |
| 10241 | return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); |
| 10242 | }); |
| 10243 | } |
| 10244 | |
| 10245 | ctx.seen.pop(); |
| 10246 | |
| 10247 | return reduceToSingleString(output, base, braces); |
| 10248 | } |
| 10249 | |
| 10250 | |
| 10251 | function formatPrimitive(ctx, value) { |
| 10252 | if (isUndefined(value)) |
| 10253 | return ctx.stylize('undefined', 'undefined'); |
| 10254 | if (isString(value)) { |
| 10255 | var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') |
| 10256 | .replace(/'/g, "\\'") |
| 10257 | .replace(/\\"/g, '"') + '\''; |
| 10258 | return ctx.stylize(simple, 'string'); |
| 10259 | } |
| 10260 | if (isNumber(value)) |
| 10261 | return ctx.stylize('' + value, 'number'); |
| 10262 | if (isBoolean(value)) |
| 10263 | return ctx.stylize('' + value, 'boolean'); |
| 10264 | if (isNull(value)) |
| 10265 | return ctx.stylize('null', 'null'); |
| 10266 | } |
| 10267 | |
| 10268 | |
| 10269 | function formatError(value) { |
| 10270 | return '[' + Error.prototype.toString.call(value) + ']'; |
| 10271 | } |
| 10272 | |
| 10273 | |
| 10274 | function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { |
| 10275 | var output = []; |
| 10276 | for (var i = 0, l = value.length; i < l; ++i) { |
| 10277 | if (hasOwnProperty(value, String(i))) { |
| 10278 | output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, |
| 10279 | String(i), true)); |
| 10280 | } else { |
| 10281 | output.push(''); |
| 10282 | } |
| 10283 | } |
| 10284 | keys.forEach(function(key) { |
| 10285 | if (!key.match(/^\d+$/)) { |
| 10286 | output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, |
| 10287 | key, true)); |
| 10288 | } |
| 10289 | }); |
| 10290 | return output; |
| 10291 | } |
| 10292 | |
| 10293 | |
| 10294 | function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { |
| 10295 | var name, str, desc; |
| 10296 | desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; |
| 10297 | if (desc.get) { |
| 10298 | if (desc.set) { |
| 10299 | str = ctx.stylize('[Getter/Setter]', 'special'); |
| 10300 | } else { |
| 10301 | str = ctx.stylize('[Getter]', 'special'); |
| 10302 | } |
| 10303 | } else { |
| 10304 | if (desc.set) { |
| 10305 | str = ctx.stylize('[Setter]', 'special'); |
| 10306 | } |
| 10307 | } |
| 10308 | if (!hasOwnProperty(visibleKeys, key)) { |
| 10309 | name = '[' + key + ']'; |
| 10310 | } |
| 10311 | if (!str) { |
| 10312 | if (ctx.seen.indexOf(desc.value) < 0) { |
| 10313 | if (isNull(recurseTimes)) { |
| 10314 | str = formatValue(ctx, desc.value, null); |
| 10315 | } else { |
| 10316 | str = formatValue(ctx, desc.value, recurseTimes - 1); |
| 10317 | } |
| 10318 | if (str.indexOf('\n') > -1) { |
| 10319 | if (array) { |
| 10320 | str = str.split('\n').map(function(line) { |
| 10321 | return ' ' + line; |
| 10322 | }).join('\n').substr(2); |
| 10323 | } else { |
| 10324 | str = '\n' + str.split('\n').map(function(line) { |
| 10325 | return ' ' + line; |
| 10326 | }).join('\n'); |
| 10327 | } |
| 10328 | } |
| 10329 | } else { |
| 10330 | str = ctx.stylize('[Circular]', 'special'); |
| 10331 | } |
| 10332 | } |
| 10333 | if (isUndefined(name)) { |
| 10334 | if (array && key.match(/^\d+$/)) { |
| 10335 | return str; |
| 10336 | } |
| 10337 | name = JSON.stringify('' + key); |
| 10338 | if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { |
| 10339 | name = name.substr(1, name.length - 2); |
| 10340 | name = ctx.stylize(name, 'name'); |
| 10341 | } else { |
| 10342 | name = name.replace(/'/g, "\\'") |
| 10343 | .replace(/\\"/g, '"') |
| 10344 | .replace(/(^"|"$)/g, "'"); |
| 10345 | name = ctx.stylize(name, 'string'); |
| 10346 | } |
| 10347 | } |
| 10348 | |
| 10349 | return name + ': ' + str; |
| 10350 | } |
| 10351 | |
| 10352 | |
| 10353 | function reduceToSingleString(output, base, braces) { |
| 10354 | var numLinesEst = 0; |
| 10355 | var length = output.reduce(function(prev, cur) { |
| 10356 | numLinesEst++; |
| 10357 | if (cur.indexOf('\n') >= 0) numLinesEst++; |
| 10358 | return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; |
| 10359 | }, 0); |
| 10360 | |
| 10361 | if (length > 60) { |
| 10362 | return braces[0] + |
| 10363 | (base === '' ? '' : base + '\n ') + |
| 10364 | ' ' + |
| 10365 | output.join(',\n ') + |
| 10366 | ' ' + |
| 10367 | braces[1]; |
| 10368 | } |
| 10369 | |
| 10370 | return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; |
| 10371 | } |
| 10372 | function isArray(ar) { |
| 10373 | return Array.isArray(ar); |
| 10374 | } |
| 10375 | exports.isArray = isArray; |
| 10376 | |
| 10377 | function isBoolean(arg) { |
| 10378 | return typeof arg === 'boolean'; |
| 10379 | } |
| 10380 | exports.isBoolean = isBoolean; |
| 10381 | |
| 10382 | function isNull(arg) { |
| 10383 | return arg === null; |
| 10384 | } |
| 10385 | exports.isNull = isNull; |
| 10386 | |
| 10387 | function isNullOrUndefined(arg) { |
| 10388 | return arg == null; |
| 10389 | } |
| 10390 | exports.isNullOrUndefined = isNullOrUndefined; |
| 10391 | |
| 10392 | function isNumber(arg) { |
| 10393 | return typeof arg === 'number'; |
| 10394 | } |
| 10395 | exports.isNumber = isNumber; |
| 10396 | |
| 10397 | function isString(arg) { |
| 10398 | return typeof arg === 'string'; |
| 10399 | } |
| 10400 | exports.isString = isString; |
| 10401 | |
| 10402 | function isSymbol(arg) { |
| 10403 | return typeof arg === 'symbol'; |
| 10404 | } |
| 10405 | exports.isSymbol = isSymbol; |
| 10406 | |
| 10407 | function isUndefined(arg) { |
| 10408 | return arg === void 0; |
| 10409 | } |
| 10410 | exports.isUndefined = isUndefined; |
| 10411 | |
| 10412 | function isRegExp(re) { |
| 10413 | return isObject(re) && objectToString(re) === '[object RegExp]'; |
| 10414 | } |
| 10415 | exports.isRegExp = isRegExp; |
| 10416 | |
| 10417 | function isObject(arg) { |
| 10418 | return typeof arg === 'object' && arg !== null; |
| 10419 | } |
| 10420 | exports.isObject = isObject; |
| 10421 | |
| 10422 | function isDate(d) { |
| 10423 | return isObject(d) && objectToString(d) === '[object Date]'; |
| 10424 | } |
| 10425 | exports.isDate = isDate; |
| 10426 | |
| 10427 | function isError(e) { |
| 10428 | return isObject(e) && |
| 10429 | (objectToString(e) === '[object Error]' || e instanceof Error); |
| 10430 | } |
| 10431 | exports.isError = isError; |
| 10432 | |
| 10433 | function isFunction(arg) { |
| 10434 | return typeof arg === 'function'; |
| 10435 | } |
| 10436 | exports.isFunction = isFunction; |
| 10437 | |
| 10438 | function isPrimitive(arg) { |
| 10439 | return arg === null || |
| 10440 | typeof arg === 'boolean' || |
| 10441 | typeof arg === 'number' || |
| 10442 | typeof arg === 'string' || |
| 10443 | typeof arg === 'symbol' || // ES6 symbol |
| 10444 | typeof arg === 'undefined'; |
| 10445 | } |
| 10446 | exports.isPrimitive = isPrimitive; |
| 10447 | |
| 10448 | exports.isBuffer = _dereq_('./support/isBuffer'); |
| 10449 | |
| 10450 | function objectToString(o) { |
| 10451 | return Object.prototype.toString.call(o); |
| 10452 | } |
| 10453 | |
| 10454 | |
| 10455 | function pad(n) { |
| 10456 | return n < 10 ? '0' + n.toString(10) : n.toString(10); |
| 10457 | } |
| 10458 | |
| 10459 | |
| 10460 | var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', |
| 10461 | 'Oct', 'Nov', 'Dec']; |
| 10462 | function timestamp() { |
| 10463 | var d = new Date(); |
| 10464 | var time = [pad(d.getHours()), |
| 10465 | pad(d.getMinutes()), |
| 10466 | pad(d.getSeconds())].join(':'); |
| 10467 | return [d.getDate(), months[d.getMonth()], time].join(' '); |
| 10468 | } |
| 10469 | exports.log = function() { |
| 10470 | console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); |
| 10471 | }; |
| 10472 | exports.inherits = _dereq_('inherits'); |
| 10473 | |
| 10474 | exports._extend = function(origin, add) { |
| 10475 | if (!add || !isObject(add)) return origin; |
| 10476 | |
| 10477 | var keys = Object.keys(add); |
| 10478 | var i = keys.length; |
| 10479 | while (i--) { |
| 10480 | origin[keys[i]] = add[keys[i]]; |
| 10481 | } |
| 10482 | return origin; |
| 10483 | }; |
| 10484 | |
| 10485 | function hasOwnProperty(obj, prop) { |
| 10486 | return Object.prototype.hasOwnProperty.call(obj, prop); |
| 10487 | } |
| 10488 | |
| 10489 | }).call(this,_dereq_("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) |
| 10490 | }, |
| 10491 | {"./support/isBuffer":14,"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18,"inherits":17}], |
| 10492 | 16:[function(_dereq_,module,exports){ |
| 10493 | |
| 10494 | function EventEmitter() { |
| 10495 | this._events = this._events || {}; |
| 10496 | this._maxListeners = this._maxListeners || undefined; |
| 10497 | } |
| 10498 | module.exports = EventEmitter; |
| 10499 | EventEmitter.EventEmitter = EventEmitter; |
| 10500 | |
| 10501 | EventEmitter.prototype._events = undefined; |
| 10502 | EventEmitter.prototype._maxListeners = undefined; |
| 10503 | EventEmitter.defaultMaxListeners = 10; |
| 10504 | EventEmitter.prototype.setMaxListeners = function(n) { |
| 10505 | if (!isNumber(n) || n < 0 || isNaN(n)) |
| 10506 | throw TypeError('n must be a positive number'); |
| 10507 | this._maxListeners = n; |
| 10508 | return this; |
| 10509 | }; |
| 10510 | |
| 10511 | EventEmitter.prototype.emit = function(type) { |
| 10512 | var er, handler, len, args, i, listeners; |
| 10513 | |
| 10514 | if (!this._events) |
| 10515 | this._events = {}; |
| 10516 | if (type === 'error') { |
| 10517 | if (!this._events.error || |
| 10518 | (isObject(this._events.error) && !this._events.error.length)) { |
| 10519 | er = arguments[1]; |
| 10520 | if (er instanceof Error) { |
| 10521 | throw er; // Unhandled 'error' event |
| 10522 | } else { |
| 10523 | throw TypeError('Uncaught, unspecified "error" event.'); |
| 10524 | } |
| 10525 | return false; |
| 10526 | } |
| 10527 | } |
| 10528 | |
| 10529 | handler = this._events[type]; |
| 10530 | |
| 10531 | if (isUndefined(handler)) |
| 10532 | return false; |
| 10533 | |
| 10534 | if (isFunction(handler)) { |
| 10535 | switch (arguments.length) { |
| 10536 | case 1: |
| 10537 | handler.call(this); |
| 10538 | break; |
| 10539 | case 2: |
| 10540 | handler.call(this, arguments[1]); |
| 10541 | break; |
| 10542 | case 3: |
| 10543 | handler.call(this, arguments[1], arguments[2]); |
| 10544 | break; |
| 10545 | default: |
| 10546 | len = arguments.length; |
| 10547 | args = new Array(len - 1); |
| 10548 | for (i = 1; i < len; i++) |
| 10549 | args[i - 1] = arguments[i]; |
| 10550 | handler.apply(this, args); |
| 10551 | } |
| 10552 | } else if (isObject(handler)) { |
| 10553 | len = arguments.length; |
| 10554 | args = new Array(len - 1); |
| 10555 | for (i = 1; i < len; i++) |
| 10556 | args[i - 1] = arguments[i]; |
| 10557 | |
| 10558 | listeners = handler.slice(); |
| 10559 | len = listeners.length; |
| 10560 | for (i = 0; i < len; i++) |
| 10561 | listeners[i].apply(this, args); |
| 10562 | } |
| 10563 | |
| 10564 | return true; |
| 10565 | }; |
| 10566 | |
| 10567 | EventEmitter.prototype.addListener = function(type, listener) { |
| 10568 | var m; |
| 10569 | |
| 10570 | if (!isFunction(listener)) |
| 10571 | throw TypeError('listener must be a function'); |
| 10572 | |
| 10573 | if (!this._events) |
| 10574 | this._events = {}; |
| 10575 | if (this._events.newListener) |
| 10576 | this.emit('newListener', type, |
| 10577 | isFunction(listener.listener) ? |
| 10578 | listener.listener : listener); |
| 10579 | |
| 10580 | if (!this._events[type]) |
| 10581 | this._events[type] = listener; |
| 10582 | else if (isObject(this._events[type])) |
| 10583 | this._events[type].push(listener); |
| 10584 | else |
| 10585 | this._events[type] = [this._events[type], listener]; |
| 10586 | if (isObject(this._events[type]) && !this._events[type].warned) { |
| 10587 | var m; |
| 10588 | if (!isUndefined(this._maxListeners)) { |
| 10589 | m = this._maxListeners; |
| 10590 | } else { |
| 10591 | m = EventEmitter.defaultMaxListeners; |
| 10592 | } |
| 10593 | |
| 10594 | if (m && m > 0 && this._events[type].length > m) { |
| 10595 | this._events[type].warned = true; |
| 10596 | console.error('(node) warning: possible EventEmitter memory ' + |
| 10597 | 'leak detected. %d listeners added. ' + |
| 10598 | 'Use emitter.setMaxListeners() to increase limit.', |
| 10599 | this._events[type].length); |
| 10600 | console.trace(); |
| 10601 | } |
| 10602 | } |
| 10603 | |
| 10604 | return this; |
| 10605 | }; |
| 10606 | |
| 10607 | EventEmitter.prototype.on = EventEmitter.prototype.addListener; |
| 10608 | |
| 10609 | EventEmitter.prototype.once = function(type, listener) { |
| 10610 | if (!isFunction(listener)) |
| 10611 | throw TypeError('listener must be a function'); |
| 10612 | |
| 10613 | var fired = false; |
| 10614 | |
| 10615 | function g() { |
| 10616 | this.removeListener(type, g); |
| 10617 | |
| 10618 | if (!fired) { |
| 10619 | fired = true; |
| 10620 | listener.apply(this, arguments); |
| 10621 | } |
| 10622 | } |
| 10623 | |
| 10624 | g.listener = listener; |
| 10625 | this.on(type, g); |
| 10626 | |
| 10627 | return this; |
| 10628 | }; |
| 10629 | EventEmitter.prototype.removeListener = function(type, listener) { |
| 10630 | var list, position, length, i; |
| 10631 | |
| 10632 | if (!isFunction(listener)) |
| 10633 | throw TypeError('listener must be a function'); |
| 10634 | |
| 10635 | if (!this._events || !this._events[type]) |
| 10636 | return this; |
| 10637 | |
| 10638 | list = this._events[type]; |
| 10639 | length = list.length; |
| 10640 | position = -1; |
| 10641 | |
| 10642 | if (list === listener || |
| 10643 | (isFunction(list.listener) && list.listener === listener)) { |
| 10644 | delete this._events[type]; |
| 10645 | if (this._events.removeListener) |
| 10646 | this.emit('removeListener', type, listener); |
| 10647 | |
| 10648 | } else if (isObject(list)) { |
| 10649 | for (i = length; i-- > 0;) { |
| 10650 | if (list[i] === listener || |
| 10651 | (list[i].listener && list[i].listener === listener)) { |
| 10652 | position = i; |
| 10653 | break; |
| 10654 | } |
| 10655 | } |
| 10656 | |
| 10657 | if (position < 0) |
| 10658 | return this; |
| 10659 | |
| 10660 | if (list.length === 1) { |
| 10661 | list.length = 0; |
| 10662 | delete this._events[type]; |
| 10663 | } else { |
| 10664 | list.splice(position, 1); |
| 10665 | } |
| 10666 | |
| 10667 | if (this._events.removeListener) |
| 10668 | this.emit('removeListener', type, listener); |
| 10669 | } |
| 10670 | |
| 10671 | return this; |
| 10672 | }; |
| 10673 | |
| 10674 | EventEmitter.prototype.removeAllListeners = function(type) { |
| 10675 | var key, listeners; |
| 10676 | |
| 10677 | if (!this._events) |
| 10678 | return this; |
| 10679 | if (!this._events.removeListener) { |
| 10680 | if (arguments.length === 0) |
| 10681 | this._events = {}; |
| 10682 | else if (this._events[type]) |
| 10683 | delete this._events[type]; |
| 10684 | return this; |
| 10685 | } |
| 10686 | if (arguments.length === 0) { |
| 10687 | for (key in this._events) { |
| 10688 | if (key === 'removeListener') continue; |
| 10689 | this.removeAllListeners(key); |
| 10690 | } |
| 10691 | this.removeAllListeners('removeListener'); |
| 10692 | this._events = {}; |
| 10693 | return this; |
| 10694 | } |
| 10695 | |
| 10696 | listeners = this._events[type]; |
| 10697 | |
| 10698 | if (isFunction(listeners)) { |
| 10699 | this.removeListener(type, listeners); |
| 10700 | } else { |
| 10701 | while (listeners.length) |
| 10702 | this.removeListener(type, listeners[listeners.length - 1]); |
| 10703 | } |
| 10704 | delete this._events[type]; |
| 10705 | |
| 10706 | return this; |
| 10707 | }; |
| 10708 | |
| 10709 | EventEmitter.prototype.listeners = function(type) { |
| 10710 | var ret; |
| 10711 | if (!this._events || !this._events[type]) |
| 10712 | ret = []; |
| 10713 | else if (isFunction(this._events[type])) |
| 10714 | ret = [this._events[type]]; |
| 10715 | else |
| 10716 | ret = this._events[type].slice(); |
| 10717 | return ret; |
| 10718 | }; |
| 10719 | |
| 10720 | EventEmitter.listenerCount = function(emitter, type) { |
| 10721 | var ret; |
| 10722 | if (!emitter._events || !emitter._events[type]) |
| 10723 | ret = 0; |
| 10724 | else if (isFunction(emitter._events[type])) |
| 10725 | ret = 1; |
| 10726 | else |
| 10727 | ret = emitter._events[type].length; |
| 10728 | return ret; |
| 10729 | }; |
| 10730 | |
| 10731 | function isFunction(arg) { |
| 10732 | return typeof arg === 'function'; |
| 10733 | } |
| 10734 | |
| 10735 | function isNumber(arg) { |
| 10736 | return typeof arg === 'number'; |
| 10737 | } |
| 10738 | |
| 10739 | function isObject(arg) { |
| 10740 | return typeof arg === 'object' && arg !== null; |
| 10741 | } |
| 10742 | |
| 10743 | function isUndefined(arg) { |
| 10744 | return arg === void 0; |
| 10745 | } |
| 10746 | |
| 10747 | }, |
| 10748 | {}], |
| 10749 | 17:[function(_dereq_,module,exports){ |
| 10750 | if (typeof Object.create === 'function') { |
| 10751 | module.exports = function inherits(ctor, superCtor) { |
| 10752 | ctor.super_ = superCtor |
| 10753 | ctor.prototype = Object.create(superCtor.prototype, { |
| 10754 | constructor: { |
| 10755 | value: ctor, |
| 10756 | enumerable: false, |
| 10757 | writable: true, |
| 10758 | configurable: true |
| 10759 | } |
| 10760 | }); |
| 10761 | }; |
| 10762 | } else { |
| 10763 | module.exports = function inherits(ctor, superCtor) { |
| 10764 | ctor.super_ = superCtor |
| 10765 | var TempCtor = function () {} |
| 10766 | TempCtor.prototype = superCtor.prototype |
| 10767 | ctor.prototype = new TempCtor() |
| 10768 | ctor.prototype.constructor = ctor |
| 10769 | } |
| 10770 | } |
| 10771 | |
| 10772 | }, |
| 10773 | {}], |
| 10774 | 18:[function(_dereq_,module,exports){ |
| 10775 | |
| 10776 | var process = module.exports = {}; |
| 10777 | |
| 10778 | process.nextTick = (function () { |
| 10779 | var canSetImmediate = typeof window !== 'undefined' |
| 10780 | && window.setImmediate; |
| 10781 | var canPost = typeof window !== 'undefined' |
| 10782 | && window.postMessage && window.addEventListener |
| 10783 | ; |
| 10784 | |
| 10785 | if (canSetImmediate) { |
| 10786 | return function (f) { return window.setImmediate(f) }; |
| 10787 | } |
| 10788 | |
| 10789 | if (canPost) { |
| 10790 | var queue = []; |
| 10791 | window.addEventListener('message', function (ev) { |
| 10792 | var source = ev.source; |
| 10793 | if ((source === window || source === null) && ev.data === 'process-tick') { |
| 10794 | ev.stopPropagation(); |
| 10795 | if (queue.length > 0) { |
| 10796 | var fn = queue.shift(); |
| 10797 | fn(); |
| 10798 | } |
| 10799 | } |
| 10800 | }, true); |
| 10801 | |
| 10802 | return function nextTick(fn) { |
| 10803 | queue.push(fn); |
| 10804 | window.postMessage('process-tick', '*'); |
| 10805 | }; |
| 10806 | } |
| 10807 | |
| 10808 | return function nextTick(fn) { |
| 10809 | setTimeout(fn, 0); |
| 10810 | }; |
| 10811 | })(); |
| 10812 | |
| 10813 | process.title = 'browser'; |
| 10814 | process.browser = true; |
| 10815 | process.env = {}; |
| 10816 | process.argv = []; |
| 10817 | |
| 10818 | function noop() {} |
| 10819 | |
| 10820 | process.on = noop; |
| 10821 | process.once = noop; |
| 10822 | process.off = noop; |
| 10823 | process.emit = noop; |
| 10824 | |
| 10825 | process.binding = function (name) { |
| 10826 | throw new Error('process.binding is not supported'); |
| 10827 | } |
| 10828 | process.cwd = function () { return '/' }; |
| 10829 | process.chdir = function (dir) { |
| 10830 | throw new Error('process.chdir is not supported'); |
| 10831 | }; |
| 10832 | |
| 10833 | }, |
| 10834 | {}], |
| 10835 | 19:[function(_dereq_,module,exports){ |
| 10836 | module.exports=_dereq_(14) |
| 10837 | }, |
| 10838 | {}], |
| 10839 | 20:[function(_dereq_,module,exports){ |
| 10840 | module.exports=_dereq_(15) |
| 10841 | }, |
| 10842 | {"./support/isBuffer":19,"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18,"inherits":17}]},{},[9]) |
| 10843 | (9) |
| 10844 | |
| 10845 | }); |
| 10846 | |
| 10847 | define("ace/mode/html_worker",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/worker/mirror","ace/mode/html/saxparser"], function(require, exports, module) { |
| 10848 | "use strict"; |
| 10849 | |
| 10850 | var oop = require("../lib/oop"); |
| 10851 | var lang = require("../lib/lang"); |
| 10852 | var Mirror = require("../worker/mirror").Mirror; |
| 10853 | var SAXParser = require("./html/saxparser").SAXParser; |
| 10854 | |
| 10855 | var errorTypes = { |
| 10856 | "expected-doctype-but-got-start-tag": "info", |
| 10857 | "expected-doctype-but-got-chars": "info", |
| 10858 | "non-html-root": "info" |
| 10859 | }; |
| 10860 | |
| 10861 | var Worker = exports.Worker = function(sender) { |
| 10862 | Mirror.call(this, sender); |
| 10863 | this.setTimeout(400); |
| 10864 | this.context = null; |
| 10865 | }; |
| 10866 | |
| 10867 | oop.inherits(Worker, Mirror); |
| 10868 | |
| 10869 | (function() { |
| 10870 | |
| 10871 | this.setOptions = function(options) { |
| 10872 | this.context = options.context; |
| 10873 | }; |
| 10874 | |
| 10875 | this.onUpdate = function() { |
| 10876 | var value = this.doc.getValue(); |
| 10877 | if (!value) |
| 10878 | return; |
| 10879 | var parser = new SAXParser(); |
| 10880 | var errors = []; |
| 10881 | var noop = function(){}; |
| 10882 | parser.contentHandler = { |
| 10883 | startDocument: noop, |
| 10884 | endDocument: noop, |
| 10885 | startElement: noop, |
| 10886 | endElement: noop, |
| 10887 | characters: noop |
| 10888 | }; |
| 10889 | parser.errorHandler = { |
| 10890 | error: function(message, location, code) { |
| 10891 | errors.push({ |
| 10892 | row: location.line, |
| 10893 | column: location.column, |
| 10894 | text: message, |
| 10895 | type: errorTypes[code] || "error" |
| 10896 | }); |
| 10897 | } |
| 10898 | }; |
| 10899 | if (this.context) |
| 10900 | parser.parseFragment(value, this.context); |
| 10901 | else |
| 10902 | parser.parse(value); |
| 10903 | this.sender.emit("error", errors); |
| 10904 | }; |
| 10905 | |
| 10906 | }).call(Worker.prototype); |
| 10907 | |
| 10908 | }); |
| 10909 | |
| 10910 | define("ace/lib/es5-shim",["require","exports","module"], function(require, exports, module) { |
| 10911 | |
| 10912 | function Empty() {} |
| 10913 | |
| 10914 | if (!Function.prototype.bind) { |
| 10915 | Function.prototype.bind = function bind(that) { // .length is 1 |
| 10916 | var target = this; |
| 10917 | if (typeof target != "function") { |
| 10918 | throw new TypeError("Function.prototype.bind called on incompatible " + target); |
| 10919 | } |
| 10920 | var args = slice.call(arguments, 1); // for normal call |
| 10921 | var bound = function () { |
| 10922 | |
| 10923 | if (this instanceof bound) { |
| 10924 | |
| 10925 | var result = target.apply( |
| 10926 | this, |
| 10927 | args.concat(slice.call(arguments)) |
| 10928 | ); |
| 10929 | if (Object(result) === result) { |
| 10930 | return result; |
| 10931 | } |
| 10932 | return this; |
| 10933 | |
| 10934 | } else { |
| 10935 | return target.apply( |
| 10936 | that, |
| 10937 | args.concat(slice.call(arguments)) |
| 10938 | ); |
| 10939 | |
| 10940 | } |
| 10941 | |
| 10942 | }; |
| 10943 | if(target.prototype) { |
| 10944 | Empty.prototype = target.prototype; |
| 10945 | bound.prototype = new Empty(); |
| 10946 | Empty.prototype = null; |
| 10947 | } |
| 10948 | return bound; |
| 10949 | }; |
| 10950 | } |
| 10951 | var call = Function.prototype.call; |
| 10952 | var prototypeOfArray = Array.prototype; |
| 10953 | var prototypeOfObject = Object.prototype; |
| 10954 | var slice = prototypeOfArray.slice; |
| 10955 | var _toString = call.bind(prototypeOfObject.toString); |
| 10956 | var owns = call.bind(prototypeOfObject.hasOwnProperty); |
| 10957 | var defineGetter; |
| 10958 | var defineSetter; |
| 10959 | var lookupGetter; |
| 10960 | var lookupSetter; |
| 10961 | var supportsAccessors; |
| 10962 | if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) { |
| 10963 | defineGetter = call.bind(prototypeOfObject.__defineGetter__); |
| 10964 | defineSetter = call.bind(prototypeOfObject.__defineSetter__); |
| 10965 | lookupGetter = call.bind(prototypeOfObject.__lookupGetter__); |
| 10966 | lookupSetter = call.bind(prototypeOfObject.__lookupSetter__); |
| 10967 | } |
| 10968 | if ([1,2].splice(0).length != 2) { |
| 10969 | if(function() { // test IE < 9 to splice bug - see issue #138 |
| 10970 | function makeArray(l) { |
| 10971 | var a = new Array(l+2); |
| 10972 | a[0] = a[1] = 0; |
| 10973 | return a; |
| 10974 | } |
| 10975 | var array = [], lengthBefore; |
| 10976 | |
| 10977 | array.splice.apply(array, makeArray(20)); |
| 10978 | array.splice.apply(array, makeArray(26)); |
| 10979 | |
| 10980 | lengthBefore = array.length; //46 |
| 10981 | array.splice(5, 0, "XXX"); // add one element |
| 10982 | |
| 10983 | lengthBefore + 1 == array.length |
| 10984 | |
| 10985 | if (lengthBefore + 1 == array.length) { |
| 10986 | return true;// has right splice implementation without bugs |
| 10987 | } |
| 10988 | }()) {//IE 6/7 |
| 10989 | var array_splice = Array.prototype.splice; |
| 10990 | Array.prototype.splice = function(start, deleteCount) { |
| 10991 | if (!arguments.length) { |
| 10992 | return []; |
| 10993 | } else { |
| 10994 | return array_splice.apply(this, [ |
| 10995 | start === void 0 ? 0 : start, |
| 10996 | deleteCount === void 0 ? (this.length - start) : deleteCount |
| 10997 | ].concat(slice.call(arguments, 2))) |
| 10998 | } |
| 10999 | }; |
| 11000 | } else {//IE8 |
| 11001 | Array.prototype.splice = function(pos, removeCount){ |
| 11002 | var length = this.length; |
| 11003 | if (pos > 0) { |
| 11004 | if (pos > length) |
| 11005 | pos = length; |
| 11006 | } else if (pos == void 0) { |
| 11007 | pos = 0; |
| 11008 | } else if (pos < 0) { |
| 11009 | pos = Math.max(length + pos, 0); |
| 11010 | } |
| 11011 | |
| 11012 | if (!(pos+removeCount < length)) |
| 11013 | removeCount = length - pos; |
| 11014 | |
| 11015 | var removed = this.slice(pos, pos+removeCount); |
| 11016 | var insert = slice.call(arguments, 2); |
| 11017 | var add = insert.length; |
| 11018 | if (pos === length) { |
| 11019 | if (add) { |
| 11020 | this.push.apply(this, insert); |
| 11021 | } |
| 11022 | } else { |
| 11023 | var remove = Math.min(removeCount, length - pos); |
| 11024 | var tailOldPos = pos + remove; |
| 11025 | var tailNewPos = tailOldPos + add - remove; |
| 11026 | var tailCount = length - tailOldPos; |
| 11027 | var lengthAfterRemove = length - remove; |
| 11028 | |
| 11029 | if (tailNewPos < tailOldPos) { // case A |
| 11030 | for (var i = 0; i < tailCount; ++i) { |
| 11031 | this[tailNewPos+i] = this[tailOldPos+i]; |
| 11032 | } |
| 11033 | } else if (tailNewPos > tailOldPos) { // case B |
| 11034 | for (i = tailCount; i--; ) { |
| 11035 | this[tailNewPos+i] = this[tailOldPos+i]; |
| 11036 | } |
| 11037 | } // else, add == remove (nothing to do) |
| 11038 | |
| 11039 | if (add && pos === lengthAfterRemove) { |
| 11040 | this.length = lengthAfterRemove; // truncate array |
| 11041 | this.push.apply(this, insert); |
| 11042 | } else { |
| 11043 | this.length = lengthAfterRemove + add; // reserves space |
| 11044 | for (i = 0; i < add; ++i) { |
| 11045 | this[pos+i] = insert[i]; |
| 11046 | } |
| 11047 | } |
| 11048 | } |
| 11049 | return removed; |
| 11050 | }; |
| 11051 | } |
| 11052 | } |
| 11053 | if (!Array.isArray) { |
| 11054 | Array.isArray = function isArray(obj) { |
| 11055 | return _toString(obj) == "[object Array]"; |
| 11056 | }; |
| 11057 | } |
| 11058 | var boxedString = Object("a"), |
| 11059 | splitString = boxedString[0] != "a" || !(0 in boxedString); |
| 11060 | |
| 11061 | if (!Array.prototype.forEach) { |
| 11062 | Array.prototype.forEach = function forEach(fun /*, thisp*/) { |
| 11063 | var object = toObject(this), |
| 11064 | self = splitString && _toString(this) == "[object String]" ? |
| 11065 | this.split("") : |
| 11066 | object, |
| 11067 | thisp = arguments[1], |
| 11068 | i = -1, |
| 11069 | length = self.length >>> 0; |
| 11070 | if (_toString(fun) != "[object Function]") { |
| 11071 | throw new TypeError(); // TODO message |
| 11072 | } |
| 11073 | |
| 11074 | while (++i < length) { |
| 11075 | if (i in self) { |
| 11076 | fun.call(thisp, self[i], i, object); |
| 11077 | } |
| 11078 | } |
| 11079 | }; |
| 11080 | } |
| 11081 | if (!Array.prototype.map) { |
| 11082 | Array.prototype.map = function map(fun /*, thisp*/) { |
| 11083 | var object = toObject(this), |
| 11084 | self = splitString && _toString(this) == "[object String]" ? |
| 11085 | this.split("") : |
| 11086 | object, |
| 11087 | length = self.length >>> 0, |
| 11088 | result = Array(length), |
| 11089 | thisp = arguments[1]; |
| 11090 | if (_toString(fun) != "[object Function]") { |
| 11091 | throw new TypeError(fun + " is not a function"); |
| 11092 | } |
| 11093 | |
| 11094 | for (var i = 0; i < length; i++) { |
| 11095 | if (i in self) |
| 11096 | result[i] = fun.call(thisp, self[i], i, object); |
| 11097 | } |
| 11098 | return result; |
| 11099 | }; |
| 11100 | } |
| 11101 | if (!Array.prototype.filter) { |
| 11102 | Array.prototype.filter = function filter(fun /*, thisp */) { |
| 11103 | var object = toObject(this), |
| 11104 | self = splitString && _toString(this) == "[object String]" ? |
| 11105 | this.split("") : |
| 11106 | object, |
| 11107 | length = self.length >>> 0, |
| 11108 | result = [], |
| 11109 | value, |
| 11110 | thisp = arguments[1]; |
| 11111 | if (_toString(fun) != "[object Function]") { |
| 11112 | throw new TypeError(fun + " is not a function"); |
| 11113 | } |
| 11114 | |
| 11115 | for (var i = 0; i < length; i++) { |
| 11116 | if (i in self) { |
| 11117 | value = self[i]; |
| 11118 | if (fun.call(thisp, value, i, object)) { |
| 11119 | result.push(value); |
| 11120 | } |
| 11121 | } |
| 11122 | } |
| 11123 | return result; |
| 11124 | }; |
| 11125 | } |
| 11126 | if (!Array.prototype.every) { |
| 11127 | Array.prototype.every = function every(fun /*, thisp */) { |
| 11128 | var object = toObject(this), |
| 11129 | self = splitString && _toString(this) == "[object String]" ? |
| 11130 | this.split("") : |
| 11131 | object, |
| 11132 | length = self.length >>> 0, |
| 11133 | thisp = arguments[1]; |
| 11134 | if (_toString(fun) != "[object Function]") { |
| 11135 | throw new TypeError(fun + " is not a function"); |
| 11136 | } |
| 11137 | |
| 11138 | for (var i = 0; i < length; i++) { |
| 11139 | if (i in self && !fun.call(thisp, self[i], i, object)) { |
| 11140 | return false; |
| 11141 | } |
| 11142 | } |
| 11143 | return true; |
| 11144 | }; |
| 11145 | } |
| 11146 | if (!Array.prototype.some) { |
| 11147 | Array.prototype.some = function some(fun /*, thisp */) { |
| 11148 | var object = toObject(this), |
| 11149 | self = splitString && _toString(this) == "[object String]" ? |
| 11150 | this.split("") : |
| 11151 | object, |
| 11152 | length = self.length >>> 0, |
| 11153 | thisp = arguments[1]; |
| 11154 | if (_toString(fun) != "[object Function]") { |
| 11155 | throw new TypeError(fun + " is not a function"); |
| 11156 | } |
| 11157 | |
| 11158 | for (var i = 0; i < length; i++) { |
| 11159 | if (i in self && fun.call(thisp, self[i], i, object)) { |
| 11160 | return true; |
| 11161 | } |
| 11162 | } |
| 11163 | return false; |
| 11164 | }; |
| 11165 | } |
| 11166 | if (!Array.prototype.reduce) { |
| 11167 | Array.prototype.reduce = function reduce(fun /*, initial*/) { |
| 11168 | var object = toObject(this), |
| 11169 | self = splitString && _toString(this) == "[object String]" ? |
| 11170 | this.split("") : |
| 11171 | object, |
| 11172 | length = self.length >>> 0; |
| 11173 | if (_toString(fun) != "[object Function]") { |
| 11174 | throw new TypeError(fun + " is not a function"); |
| 11175 | } |
| 11176 | if (!length && arguments.length == 1) { |
| 11177 | throw new TypeError("reduce of empty array with no initial value"); |
| 11178 | } |
| 11179 | |
| 11180 | var i = 0; |
| 11181 | var result; |
| 11182 | if (arguments.length >= 2) { |
| 11183 | result = arguments[1]; |
| 11184 | } else { |
| 11185 | do { |
| 11186 | if (i in self) { |
| 11187 | result = self[i++]; |
| 11188 | break; |
| 11189 | } |
| 11190 | if (++i >= length) { |
| 11191 | throw new TypeError("reduce of empty array with no initial value"); |
| 11192 | } |
| 11193 | } while (true); |
| 11194 | } |
| 11195 | |
| 11196 | for (; i < length; i++) { |
| 11197 | if (i in self) { |
| 11198 | result = fun.call(void 0, result, self[i], i, object); |
| 11199 | } |
| 11200 | } |
| 11201 | |
| 11202 | return result; |
| 11203 | }; |
| 11204 | } |
| 11205 | if (!Array.prototype.reduceRight) { |
| 11206 | Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) { |
| 11207 | var object = toObject(this), |
| 11208 | self = splitString && _toString(this) == "[object String]" ? |
| 11209 | this.split("") : |
| 11210 | object, |
| 11211 | length = self.length >>> 0; |
| 11212 | if (_toString(fun) != "[object Function]") { |
| 11213 | throw new TypeError(fun + " is not a function"); |
| 11214 | } |
| 11215 | if (!length && arguments.length == 1) { |
| 11216 | throw new TypeError("reduceRight of empty array with no initial value"); |
| 11217 | } |
| 11218 | |
| 11219 | var result, i = length - 1; |
| 11220 | if (arguments.length >= 2) { |
| 11221 | result = arguments[1]; |
| 11222 | } else { |
| 11223 | do { |
| 11224 | if (i in self) { |
| 11225 | result = self[i--]; |
| 11226 | break; |
| 11227 | } |
| 11228 | if (--i < 0) { |
| 11229 | throw new TypeError("reduceRight of empty array with no initial value"); |
| 11230 | } |
| 11231 | } while (true); |
| 11232 | } |
| 11233 | |
| 11234 | do { |
| 11235 | if (i in this) { |
| 11236 | result = fun.call(void 0, result, self[i], i, object); |
| 11237 | } |
| 11238 | } while (i--); |
| 11239 | |
| 11240 | return result; |
| 11241 | }; |
| 11242 | } |
| 11243 | if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) { |
| 11244 | Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) { |
| 11245 | var self = splitString && _toString(this) == "[object String]" ? |
| 11246 | this.split("") : |
| 11247 | toObject(this), |
| 11248 | length = self.length >>> 0; |
| 11249 | |
| 11250 | if (!length) { |
| 11251 | return -1; |
| 11252 | } |
| 11253 | |
| 11254 | var i = 0; |
| 11255 | if (arguments.length > 1) { |
| 11256 | i = toInteger(arguments[1]); |
| 11257 | } |
| 11258 | i = i >= 0 ? i : Math.max(0, length + i); |
| 11259 | for (; i < length; i++) { |
| 11260 | if (i in self && self[i] === sought) { |
| 11261 | return i; |
| 11262 | } |
| 11263 | } |
| 11264 | return -1; |
| 11265 | }; |
| 11266 | } |
| 11267 | if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) { |
| 11268 | Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) { |
| 11269 | var self = splitString && _toString(this) == "[object String]" ? |
| 11270 | this.split("") : |
| 11271 | toObject(this), |
| 11272 | length = self.length >>> 0; |
| 11273 | |
| 11274 | if (!length) { |
| 11275 | return -1; |
| 11276 | } |
| 11277 | var i = length - 1; |
| 11278 | if (arguments.length > 1) { |
| 11279 | i = Math.min(i, toInteger(arguments[1])); |
| 11280 | } |
| 11281 | i = i >= 0 ? i : length - Math.abs(i); |
| 11282 | for (; i >= 0; i--) { |
| 11283 | if (i in self && sought === self[i]) { |
| 11284 | return i; |
| 11285 | } |
| 11286 | } |
| 11287 | return -1; |
| 11288 | }; |
| 11289 | } |
| 11290 | if (!Object.getPrototypeOf) { |
| 11291 | Object.getPrototypeOf = function getPrototypeOf(object) { |
| 11292 | return object.__proto__ || ( |
| 11293 | object.constructor ? |
| 11294 | object.constructor.prototype : |
| 11295 | prototypeOfObject |
| 11296 | ); |
| 11297 | }; |
| 11298 | } |
| 11299 | if (!Object.getOwnPropertyDescriptor) { |
| 11300 | var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " + |
| 11301 | "non-object: "; |
| 11302 | Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) { |
| 11303 | if ((typeof object != "object" && typeof object != "function") || object === null) |
| 11304 | throw new TypeError(ERR_NON_OBJECT + object); |
| 11305 | if (!owns(object, property)) |
| 11306 | return; |
| 11307 | |
| 11308 | var descriptor, getter, setter; |
| 11309 | descriptor = { enumerable: true, configurable: true }; |
| 11310 | if (supportsAccessors) { |
| 11311 | var prototype = object.__proto__; |
| 11312 | object.__proto__ = prototypeOfObject; |
| 11313 | |
| 11314 | var getter = lookupGetter(object, property); |
| 11315 | var setter = lookupSetter(object, property); |
| 11316 | object.__proto__ = prototype; |
| 11317 | |
| 11318 | if (getter || setter) { |
| 11319 | if (getter) descriptor.get = getter; |
| 11320 | if (setter) descriptor.set = setter; |
| 11321 | return descriptor; |
| 11322 | } |
| 11323 | } |
| 11324 | descriptor.value = object[property]; |
| 11325 | return descriptor; |
| 11326 | }; |
| 11327 | } |
| 11328 | if (!Object.getOwnPropertyNames) { |
| 11329 | Object.getOwnPropertyNames = function getOwnPropertyNames(object) { |
| 11330 | return Object.keys(object); |
| 11331 | }; |
| 11332 | } |
| 11333 | if (!Object.create) { |
| 11334 | var createEmpty; |
| 11335 | if (Object.prototype.__proto__ === null) { |
| 11336 | createEmpty = function () { |
| 11337 | return { "__proto__": null }; |
| 11338 | }; |
| 11339 | } else { |
| 11340 | createEmpty = function () { |
| 11341 | var empty = {}; |
| 11342 | for (var i in empty) |
| 11343 | empty[i] = null; |
| 11344 | empty.constructor = |
| 11345 | empty.hasOwnProperty = |
| 11346 | empty.propertyIsEnumerable = |
| 11347 | empty.isPrototypeOf = |
| 11348 | empty.toLocaleString = |
| 11349 | empty.toString = |
| 11350 | empty.valueOf = |
| 11351 | empty.__proto__ = null; |
| 11352 | return empty; |
| 11353 | } |
| 11354 | } |
| 11355 | |
| 11356 | Object.create = function create(prototype, properties) { |
| 11357 | var object; |
| 11358 | if (prototype === null) { |
| 11359 | object = createEmpty(); |
| 11360 | } else { |
| 11361 | if (typeof prototype != "object") |
| 11362 | throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'"); |
| 11363 | var Type = function () {}; |
| 11364 | Type.prototype = prototype; |
| 11365 | object = new Type(); |
| 11366 | object.__proto__ = prototype; |
| 11367 | } |
| 11368 | if (properties !== void 0) |
| 11369 | Object.defineProperties(object, properties); |
| 11370 | return object; |
| 11371 | }; |
| 11372 | } |
| 11373 | |
| 11374 | function doesDefinePropertyWork(object) { |
| 11375 | try { |
| 11376 | Object.defineProperty(object, "sentinel", {}); |
| 11377 | return "sentinel" in object; |
| 11378 | } catch (exception) { |
| 11379 | } |
| 11380 | } |
| 11381 | if (Object.defineProperty) { |
| 11382 | var definePropertyWorksOnObject = doesDefinePropertyWork({}); |
| 11383 | var definePropertyWorksOnDom = typeof document == "undefined" || |
| 11384 | doesDefinePropertyWork(document.createElement("div")); |
| 11385 | if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) { |
| 11386 | var definePropertyFallback = Object.defineProperty; |
| 11387 | } |
| 11388 | } |
| 11389 | |
| 11390 | if (!Object.defineProperty || definePropertyFallback) { |
| 11391 | var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: "; |
| 11392 | var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: " |
| 11393 | var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " + |
| 11394 | "on this javascript engine"; |
| 11395 | |
| 11396 | Object.defineProperty = function defineProperty(object, property, descriptor) { |
| 11397 | if ((typeof object != "object" && typeof object != "function") || object === null) |
| 11398 | throw new TypeError(ERR_NON_OBJECT_TARGET + object); |
| 11399 | if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null) |
| 11400 | throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor); |
| 11401 | if (definePropertyFallback) { |
| 11402 | try { |
| 11403 | return definePropertyFallback.call(Object, object, property, descriptor); |
| 11404 | } catch (exception) { |
| 11405 | } |
| 11406 | } |
| 11407 | if (owns(descriptor, "value")) { |
| 11408 | |
| 11409 | if (supportsAccessors && (lookupGetter(object, property) || |
| 11410 | lookupSetter(object, property))) |
| 11411 | { |
| 11412 | var prototype = object.__proto__; |
| 11413 | object.__proto__ = prototypeOfObject; |
| 11414 | delete object[property]; |
| 11415 | object[property] = descriptor.value; |
| 11416 | object.__proto__ = prototype; |
| 11417 | } else { |
| 11418 | object[property] = descriptor.value; |
| 11419 | } |
| 11420 | } else { |
| 11421 | if (!supportsAccessors) |
| 11422 | throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); |
| 11423 | if (owns(descriptor, "get")) |
| 11424 | defineGetter(object, property, descriptor.get); |
| 11425 | if (owns(descriptor, "set")) |
| 11426 | defineSetter(object, property, descriptor.set); |
| 11427 | } |
| 11428 | |
| 11429 | return object; |
| 11430 | }; |
| 11431 | } |
| 11432 | if (!Object.defineProperties) { |
| 11433 | Object.defineProperties = function defineProperties(object, properties) { |
| 11434 | for (var property in properties) { |
| 11435 | if (owns(properties, property)) |
| 11436 | Object.defineProperty(object, property, properties[property]); |
| 11437 | } |
| 11438 | return object; |
| 11439 | }; |
| 11440 | } |
| 11441 | if (!Object.seal) { |
| 11442 | Object.seal = function seal(object) { |
| 11443 | return object; |
| 11444 | }; |
| 11445 | } |
| 11446 | if (!Object.freeze) { |
| 11447 | Object.freeze = function freeze(object) { |
| 11448 | return object; |
| 11449 | }; |
| 11450 | } |
| 11451 | try { |
| 11452 | Object.freeze(function () {}); |
| 11453 | } catch (exception) { |
| 11454 | Object.freeze = (function freeze(freezeObject) { |
| 11455 | return function freeze(object) { |
| 11456 | if (typeof object == "function") { |
| 11457 | return object; |
| 11458 | } else { |
| 11459 | return freezeObject(object); |
| 11460 | } |
| 11461 | }; |
| 11462 | })(Object.freeze); |
| 11463 | } |
| 11464 | if (!Object.preventExtensions) { |
| 11465 | Object.preventExtensions = function preventExtensions(object) { |
| 11466 | return object; |
| 11467 | }; |
| 11468 | } |
| 11469 | if (!Object.isSealed) { |
| 11470 | Object.isSealed = function isSealed(object) { |
| 11471 | return false; |
| 11472 | }; |
| 11473 | } |
| 11474 | if (!Object.isFrozen) { |
| 11475 | Object.isFrozen = function isFrozen(object) { |
| 11476 | return false; |
| 11477 | }; |
| 11478 | } |
| 11479 | if (!Object.isExtensible) { |
| 11480 | Object.isExtensible = function isExtensible(object) { |
| 11481 | if (Object(object) === object) { |
| 11482 | throw new TypeError(); // TODO message |
| 11483 | } |
| 11484 | var name = ''; |
| 11485 | while (owns(object, name)) { |
| 11486 | name += '?'; |
| 11487 | } |
| 11488 | object[name] = true; |
| 11489 | var returnValue = owns(object, name); |
| 11490 | delete object[name]; |
| 11491 | return returnValue; |
| 11492 | }; |
| 11493 | } |
| 11494 | if (!Object.keys) { |
| 11495 | var hasDontEnumBug = true, |
| 11496 | dontEnums = [ |
| 11497 | "toString", |
| 11498 | "toLocaleString", |
| 11499 | "valueOf", |
| 11500 | "hasOwnProperty", |
| 11501 | "isPrototypeOf", |
| 11502 | "propertyIsEnumerable", |
| 11503 | "constructor" |
| 11504 | ], |
| 11505 | dontEnumsLength = dontEnums.length; |
| 11506 | |
| 11507 | for (var key in {"toString": null}) { |
| 11508 | hasDontEnumBug = false; |
| 11509 | } |
| 11510 | |
| 11511 | Object.keys = function keys(object) { |
| 11512 | |
| 11513 | if ( |
| 11514 | (typeof object != "object" && typeof object != "function") || |
| 11515 | object === null |
| 11516 | ) { |
| 11517 | throw new TypeError("Object.keys called on a non-object"); |
| 11518 | } |
| 11519 | |
| 11520 | var keys = []; |
| 11521 | for (var name in object) { |
| 11522 | if (owns(object, name)) { |
| 11523 | keys.push(name); |
| 11524 | } |
| 11525 | } |
| 11526 | |
| 11527 | if (hasDontEnumBug) { |
| 11528 | for (var i = 0, ii = dontEnumsLength; i < ii; i++) { |
| 11529 | var dontEnum = dontEnums[i]; |
| 11530 | if (owns(object, dontEnum)) { |
| 11531 | keys.push(dontEnum); |
| 11532 | } |
| 11533 | } |
| 11534 | } |
| 11535 | return keys; |
| 11536 | }; |
| 11537 | |
| 11538 | } |
| 11539 | if (!Date.now) { |
| 11540 | Date.now = function now() { |
| 11541 | return new Date().getTime(); |
| 11542 | }; |
| 11543 | } |
| 11544 | var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" + |
| 11545 | "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" + |
| 11546 | "\u2029\uFEFF"; |
| 11547 | if (!String.prototype.trim || ws.trim()) { |
| 11548 | ws = "[" + ws + "]"; |
| 11549 | var trimBeginRegexp = new RegExp("^" + ws + ws + "*"), |
| 11550 | trimEndRegexp = new RegExp(ws + ws + "*$"); |
| 11551 | String.prototype.trim = function trim() { |
| 11552 | return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, ""); |
| 11553 | }; |
| 11554 | } |
| 11555 | |
| 11556 | function toInteger(n) { |
| 11557 | n = +n; |
| 11558 | if (n !== n) { // isNaN |
| 11559 | n = 0; |
| 11560 | } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) { |
| 11561 | n = (n > 0 || -1) * Math.floor(Math.abs(n)); |
| 11562 | } |
| 11563 | return n; |
| 11564 | } |
| 11565 | |
| 11566 | function isPrimitive(input) { |
| 11567 | var type = typeof input; |
| 11568 | return ( |
| 11569 | input === null || |
| 11570 | type === "undefined" || |
| 11571 | type === "boolean" || |
| 11572 | type === "number" || |
| 11573 | type === "string" |
| 11574 | ); |
| 11575 | } |
| 11576 | |
| 11577 | function toPrimitive(input) { |
| 11578 | var val, valueOf, toString; |
| 11579 | if (isPrimitive(input)) { |
| 11580 | return input; |
| 11581 | } |
| 11582 | valueOf = input.valueOf; |
| 11583 | if (typeof valueOf === "function") { |
| 11584 | val = valueOf.call(input); |
| 11585 | if (isPrimitive(val)) { |
| 11586 | return val; |
| 11587 | } |
| 11588 | } |
| 11589 | toString = input.toString; |
| 11590 | if (typeof toString === "function") { |
| 11591 | val = toString.call(input); |
| 11592 | if (isPrimitive(val)) { |
| 11593 | return val; |
| 11594 | } |
| 11595 | } |
| 11596 | throw new TypeError(); |
| 11597 | } |
| 11598 | var toObject = function (o) { |
| 11599 | if (o == null) { // this matches both null and undefined |
| 11600 | throw new TypeError("can't convert "+o+" to object"); |
| 11601 | } |
| 11602 | return Object(o); |
| 11603 | }; |
| 11604 | |
| 11605 | }); |