Last active
August 29, 2015 14:07
-
-
Save also/005fd7c200b20f012e10 to your computer and use it in GitHub Desktop.
nashorn error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Exception in thread "main" java.lang.RuntimeException: Method code too large! | |
at jdk.internal.org.objectweb.asm.MethodWriter.getSize(MethodWriter.java:2065) | |
at jdk.internal.org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:856) | |
at jdk.nashorn.internal.codegen.ClassEmitter.toByteArray(ClassEmitter.java:577) | |
at jdk.nashorn.internal.codegen.CompilationPhase$8.transform(CompilationPhase.java:396) | |
at jdk.nashorn.internal.codegen.CompilationPhase.apply(CompilationPhase.java:513) | |
at jdk.nashorn.internal.codegen.Compiler.compile(Compiler.java:361) | |
at jdk.nashorn.internal.runtime.Context.compile(Context.java:1071) | |
at jdk.nashorn.internal.runtime.Context.compileScript(Context.java:1019) | |
at jdk.nashorn.internal.runtime.Context.compileScript(Context.java:490) | |
at jdk.nashorn.tools.Shell.runScripts(Shell.java:306) | |
at jdk.nashorn.tools.Shell.run(Shell.java:168) | |
at jdk.nashorn.tools.Shell.main(Shell.java:132) | |
at jdk.nashorn.tools.Shell.main(Shell.java:111) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******/ (function(modules) { // webpackBootstrap | |
/******/ // The module cache | |
/******/ var installedModules = {}; | |
/******/ | |
/******/ // The require function | |
/******/ function __webpack_require__(moduleId) { | |
/******/ | |
/******/ // Check if module is in cache | |
/******/ if(installedModules[moduleId]) | |
/******/ return installedModules[moduleId].exports; | |
/******/ | |
/******/ // Create a new module (and put it into the cache) | |
/******/ var module = installedModules[moduleId] = { | |
/******/ exports: {}, | |
/******/ id: moduleId, | |
/******/ loaded: false | |
/******/ }; | |
/******/ | |
/******/ // Execute the module function | |
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | |
/******/ | |
/******/ // Flag the module as loaded | |
/******/ module.loaded = true; | |
/******/ | |
/******/ // Return the exports of the module | |
/******/ return module.exports; | |
/******/ } | |
/******/ | |
/******/ | |
/******/ // expose the modules object (__webpack_modules__) | |
/******/ __webpack_require__.m = modules; | |
/******/ | |
/******/ // expose the module cache | |
/******/ __webpack_require__.c = installedModules; | |
/******/ | |
/******/ // __webpack_public_path__ | |
/******/ __webpack_require__.p = ""; | |
/******/ | |
/******/ // Load entry module and return exports | |
/******/ return __webpack_require__(0); | |
/******/ }) | |
/************************************************************************/ | |
/******/ ([ | |
/* 0 */ | |
/*!********************************!*\ | |
!*** ./app/nashorn/app.coffee ***! | |
\********************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var jsdom; | |
jsdom = __webpack_require__(/*! jsdom */ 1); | |
/***/ }, | |
/* 1 */ | |
/*!******************************!*\ | |
!*** ./~/jsdom/lib/jsdom.js ***! | |
\******************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(module, process) {var fs = __webpack_require__(/*! fs */ 14); | |
var path = __webpack_require__(/*! path */ 12); | |
var URL = __webpack_require__(/*! url */ 11); | |
var toFileUrl = __webpack_require__(/*! ./jsdom/utils */ 3).toFileUrl; | |
var defineGetter = __webpack_require__(/*! ./jsdom/utils */ 3).defineGetter; | |
var defineSetter = __webpack_require__(/*! ./jsdom/utils */ 3).defineSetter; | |
var style = __webpack_require__(/*! ./jsdom/level2/style */ 4); | |
var features = __webpack_require__(/*! ./jsdom/browser/documentfeatures */ 6); | |
var dom = __webpack_require__(/*! ./jsdom/living/index */ 9).dom; | |
var createWindow = __webpack_require__(/*! ./jsdom/browser/index */ 7).createWindow; | |
var browserAugmentation = __webpack_require__(/*! ./jsdom/browser/index */ 7).browserAugmentation; | |
var windowAugmentation = __webpack_require__(/*! ./jsdom/browser/index */ 7).windowAugmentation; | |
var domToHtml = __webpack_require__(/*! ./jsdom/browser/domtohtml */ 8).domToHtml; | |
var request = function(options, cb) { | |
request = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"request\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); | |
return request(options, cb); | |
} | |
exports.defaultLevel = dom.living.html; | |
exports.debugMode = false; | |
// Proxy feature functions to features module. | |
['availableDocumentFeatures', | |
'defaultDocumentFeatures', | |
'applyDocumentFeatures'].forEach(function (propName) { | |
defineGetter(exports, propName, function () { | |
return features[propName]; | |
}); | |
defineSetter(exports, propName, function (val) { | |
return features[propName] = val; | |
}); | |
}); | |
var level2Html = __webpack_require__(/*! ./jsdom/level2/html */ 5); | |
exports.level = function (level, feature) { | |
if(!feature) { | |
feature = 'core'; | |
} | |
if (String(level) === '1' || String(level) === '2' || String(level) === '3') { | |
level = 'level' + level; | |
} | |
return __webpack_require__(/*! ./jsdom */ 2)("./" + level + '/' + feature).dom[level][feature]; | |
}; | |
exports.jsdom = function (html, options) { | |
options = options || {}; | |
if (typeof options.level === 'string') { | |
options.level = exports.level(options.level, 'html'); | |
} else { | |
options.level = options.level || exports.defaultLevel; | |
} | |
options.parsingMode = options.parsingMode || "auto"; | |
if (!options.url) { | |
options.url = module.parent.id === 'jsdom' ? module.parent.parent.filename : module.parent.filename; | |
options.url = options.url.replace(/\\/g, '/'); | |
if (options.url[0] !== '/') { | |
options.url = '/' + options.url; | |
} | |
options.url = 'file://' + options.url; | |
} | |
var browser = browserAugmentation(options.level, options); | |
var doc = browser.HTMLDocument ? new browser.HTMLDocument(options) : new browser.Document(options); | |
if (options.created) { | |
options.created(null, doc.parentWindow); | |
} | |
__webpack_require__(/*! ./jsdom/selectors/index */ 10).applyQuerySelectorPrototype(options.level); | |
features.applyDocumentFeatures(doc, options.features); | |
if (html === undefined) { | |
html = ''; | |
} | |
html = String(html); | |
doc.write(html); | |
if (doc.close && !options.deferClose) { | |
doc.close(); | |
} | |
return doc; | |
}; | |
exports.jQueryify = exports.jsdom.jQueryify = function (window, jqueryUrl, callback) { | |
if (!window || !window.document) { | |
return; | |
} | |
var features = window.document.implementation._features; | |
window.document.implementation.addFeature('FetchExternalResources', ['script']); | |
window.document.implementation.addFeature('ProcessExternalResources', ['script']); | |
window.document.implementation.addFeature('MutationEvents', ['2.0']); | |
var scriptEl = window.document.createElement('script'); | |
scriptEl.className = 'jsdom'; | |
scriptEl.src = jqueryUrl; | |
scriptEl.onload = scriptEl.onerror = function () { | |
window.document.implementation._features = features; | |
if (callback) { | |
callback(window, window.jQuery); | |
} | |
}; | |
window.document.body.appendChild(scriptEl); | |
}; | |
exports.env = exports.jsdom.env = function () { | |
var config = getConfigFromArguments(arguments); | |
if (config.file) { | |
fs.readFile(config.file, 'utf-8', function (err, text) { | |
if (err) { | |
if (config.created) { | |
config.created(err); | |
} | |
if (config.done) { | |
config.done([err]); | |
} | |
return; | |
} | |
setParsingModeFromExtension(config, config.file); | |
config.html = text; | |
processHTML(config); | |
}); | |
} else if (config.html) { | |
processHTML(config); | |
} else if (config.url) { | |
handleUrl(config); | |
} else if (config.somethingToAutodetect !== undefined) { | |
var url = URL.parse(config.somethingToAutodetect); | |
if (url.protocol && url.hostname) { | |
config.url = config.somethingToAutodetect; | |
handleUrl(config.somethingToAutodetect); | |
} else { | |
fs.readFile(config.somethingToAutodetect, 'utf-8', function (err, text) { | |
if (err) { | |
if (err.code === 'ENOENT' || err.code === 'ENAMETOOLONG') { | |
config.html = config.somethingToAutodetect; | |
processHTML(config); | |
} else { | |
if (config.created) { | |
config.created(err); | |
} | |
if (config.done) { | |
config.done([err]); | |
} | |
} | |
} else { | |
setParsingModeFromExtension(config, config.somethingToAutodetect); | |
config.html = text; | |
config.url = toFileUrl(config.somethingToAutodetect); | |
processHTML(config); | |
} | |
}); | |
} | |
} | |
function handleUrl() { | |
var options = { | |
uri: config.url, | |
encoding: config.encoding || 'utf8', | |
headers: config.headers || {}, | |
proxy: config.proxy || null, | |
jar: config.jar !== undefined ? config.jar : true | |
}; | |
request(options, function (err, res, responseText) { | |
if (err) { | |
if (config.created) { | |
config.created(err); | |
} | |
if (config.done) { | |
config.done([err]); | |
} | |
return; | |
} | |
// The use of `res.request.uri.href` ensures that `window.location.href` | |
// is updated when `request` follows redirects. | |
config.html = responseText; | |
config.url = res.request.uri.href; | |
if (config.parsingMode === "auto" && ( | |
res.headers["content-type"] === "application/xml" || | |
res.headers["content-type"] === "text/xml" || | |
res.headers["content-type"] === "application/xhtml+xml")) { | |
config.parsingMode = "xml"; | |
} | |
processHTML(config); | |
}); | |
} | |
}; | |
exports.serializeDocument = function (doc) { | |
return domToHtml(doc, true); | |
}; | |
function processHTML(config) { | |
var options = { | |
features: config.features, | |
url: config.url, | |
parser: config.parser, | |
parsingMode: config.parsingMode, | |
created: config.created, | |
level: config.level | |
}; | |
if (config.document) { | |
options.referrer = config.document.referrer; | |
options.cookie = config.document.cookie; | |
options.cookieDomain = config.document.cookieDomain; | |
} | |
var window = exports.jsdom(config.html, options).parentWindow; | |
var features = JSON.parse(JSON.stringify(window.document.implementation._features)); | |
var docsLoaded = 0; | |
var totalDocs = config.scripts.length + config.src.length; | |
var readyState = null; | |
var errors = []; | |
if (!window || !window.document) { | |
if (config.created) { | |
config.created(new Error('JSDOM: a window object could not be created.')); | |
} | |
if (config.done) { | |
config.done([new Error('JSDOM: a window object could not be created.')]); | |
} | |
return; | |
} | |
window.document.implementation.addFeature('FetchExternalResources', ['script']); | |
window.document.implementation.addFeature('ProcessExternalResources', ['script']); | |
window.document.implementation.addFeature('MutationEvents', ['2.0']); | |
function scriptComplete() { | |
docsLoaded++; | |
if (docsLoaded >= totalDocs) { | |
window.document.implementation._features = features; | |
errors = errors.concat(window.document.errors || []); | |
if (errors.length === 0) { | |
errors = null; | |
} | |
process.nextTick(function() { | |
if (config.loaded) { | |
config.loaded(errors, window); | |
} | |
if (config.done) { | |
config.done(errors, window); | |
} | |
}); | |
} | |
} | |
function handleScriptError(e) { | |
if (!errors) { | |
errors = []; | |
} | |
errors.push(e.error || e.message); | |
// nextTick so that an exception within scriptComplete won't cause | |
// another script onerror (which would be an infinite loop) | |
process.nextTick(scriptComplete); | |
} | |
if (config.scripts.length > 0 || config.src.length > 0) { | |
config.scripts.forEach(function (scriptSrc) { | |
var script = window.document.createElement('script'); | |
script.className = 'jsdom'; | |
script.onload = scriptComplete; | |
script.onerror = handleScriptError; | |
script.src = scriptSrc; | |
try { | |
// protect against invalid dom | |
// ex: http://www.google.com/foo#bar | |
window.document.documentElement.appendChild(script); | |
} catch (e) { | |
handleScriptError(e); | |
} | |
}); | |
config.src.forEach(function (scriptText) { | |
var script = window.document.createElement('script'); | |
script.onload = scriptComplete; | |
script.onerror = handleScriptError; | |
script.text = scriptText; | |
window.document.documentElement.appendChild(script); | |
window.document.documentElement.removeChild(script); | |
}); | |
} else { | |
if (window.document.readyState === 'complete') { | |
scriptComplete(); | |
} else { | |
window.addEventListener('load', function() { | |
scriptComplete(); | |
}); | |
} | |
} | |
} | |
function getConfigFromArguments(args, callback) { | |
var config = {}; | |
if (typeof args[0] === 'object') { | |
var configToClone = args[0]; | |
Object.keys(configToClone).forEach(function (key) { | |
config[key] = configToClone[key]; | |
}); | |
} else { | |
var stringToAutodetect = null; | |
Array.prototype.forEach.call(args, function (arg) { | |
switch (typeof arg) { | |
case 'string': | |
config.somethingToAutodetect = arg; | |
break; | |
case 'function': | |
config.done = arg; | |
break; | |
case 'object': | |
if (Array.isArray(arg)) { | |
config.scripts = arg; | |
} else { | |
extend(config, arg); | |
} | |
break; | |
} | |
}); | |
} | |
if (!config.done && !config.created && !config.loaded) { | |
throw new Error('Must pass a "created", "loaded", "done" option or a callback to jsdom.env.'); | |
} | |
if (config.somethingToAutodetect === undefined && | |
config.html === undefined && !config.file && !config.url) { | |
throw new Error('Must pass a "html", "file", or "url" option, or a string, to jsdom.env'); | |
} | |
config.scripts = ensureArray(config.scripts); | |
config.src = ensureArray(config.src); | |
config.parsingMode = config.parsingMode || "auto"; | |
config.features = config.features || { | |
FetchExternalResources: false, | |
ProcessExternalResources: false, | |
SkipExternalResources: false | |
}; | |
if (!config.url && config.file) { | |
config.url = toFileUrl(config.file); | |
} | |
return config; | |
} | |
function ensureArray(value) { | |
var array = value || []; | |
if (typeof array === 'string') { | |
array = [array]; | |
} | |
return array; | |
} | |
function extend(config, overrides) { | |
Object.keys(overrides).forEach(function (key) { | |
config[key] = overrides[key]; | |
}); | |
} | |
function setParsingModeFromExtension(config, filename) { | |
if (config.parsingMode === "auto") { | |
var ext = path.extname(filename); | |
if (ext === ".xhtml" || ext === ".xml") { | |
config.parsingMode = "xml"; | |
} | |
} | |
} | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! (webpack)/buildin/module.js */ 27)(module), __webpack_require__(/*! (webpack)/~/node-libs-browser/~/process/browser.js */ 13))) | |
/***/ }, | |
/* 2 */ | |
/*!************************************!*\ | |
!*** ./~/jsdom/lib/jsdom ^\.\/.*$ ***! | |
\************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var map = { | |
"./browser/documentAdapter": 17, | |
"./browser/documentAdapter.js": 17, | |
"./browser/documentfeatures": 6, | |
"./browser/documentfeatures.js": 6, | |
"./browser/domtohtml": 8, | |
"./browser/domtohtml.js": 8, | |
"./browser/history": 18, | |
"./browser/history.js": 18, | |
"./browser/htmltodom": 19, | |
"./browser/htmltodom.js": 19, | |
"./browser/index": 7, | |
"./browser/index.js": 7, | |
"./browser/location": 20, | |
"./browser/location.js": 20, | |
"./browser/utils": 21, | |
"./browser/utils.js": 21, | |
"./contextify-shim": 16, | |
"./contextify-shim.js": 16, | |
"./level1/core": 29, | |
"./level1/core.js": 29, | |
"./level2/core": 22, | |
"./level2/core.js": 22, | |
"./level2/events": 23, | |
"./level2/events.js": 23, | |
"./level2/html": 5, | |
"./level2/html.js": 5, | |
"./level2/index": 24, | |
"./level2/index.js": 24, | |
"./level2/languages/javascript": 30, | |
"./level2/languages/javascript.js": 30, | |
"./level2/style": 4, | |
"./level2/style.js": 4, | |
"./level3/core": 31, | |
"./level3/core.js": 31, | |
"./level3/events": 32, | |
"./level3/events.js": 32, | |
"./level3/html": 33, | |
"./level3/html.js": 33, | |
"./level3/index": 34, | |
"./level3/index.js": 34, | |
"./level3/ls": 35, | |
"./level3/ls.js": 35, | |
"./level3/xpath": 36, | |
"./level3/xpath.js": 36, | |
"./living/core": 25, | |
"./living/core.js": 25, | |
"./living/index": 9, | |
"./living/index.js": 9, | |
"./living/node": 26, | |
"./living/node.js": 26, | |
"./selectors/index": 10, | |
"./selectors/index.js": 10, | |
"./utils": 3, | |
"./utils.js": 3 | |
}; | |
function webpackContext(req) { | |
return __webpack_require__(webpackContextResolve(req)); | |
}; | |
function webpackContextResolve(req) { | |
return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); | |
}; | |
webpackContext.keys = function webpackContextKeys() { | |
return Object.keys(map); | |
}; | |
webpackContext.resolve = webpackContextResolve; | |
module.exports = webpackContext; | |
/***/ }, | |
/* 3 */ | |
/*!************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/utils.js ***! | |
\************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(process) {var path = __webpack_require__(/*! path */ 12); | |
/** | |
* Intercepts a method by replacing the prototype's implementation | |
* with a wrapper that invokes the given interceptor instead. | |
* | |
* utils.intercept(core.Element, 'inserBefore', | |
* function(_super, args, newChild, refChild) { | |
* console.log('insertBefore', newChild, refChild); | |
* return _super.apply(this, args); | |
* } | |
* ); | |
*/ | |
exports.intercept = function(clazz, method, interceptor) { | |
var proto = clazz.prototype, | |
_super = proto[method], | |
unwrapArgs = interceptor.length > 2; | |
proto[method] = function() { | |
if (unwrapArgs) { | |
var args = Array.prototype.slice.call(arguments); | |
args.unshift(_super, arguments); | |
return interceptor.apply(this, args); | |
} | |
else { | |
return interceptor.call(this, _super, arguments); | |
} | |
}; | |
}; | |
exports.toFileUrl = function (fileName) { | |
// Beyond just the `path.resolve`, this is mostly for the benefit of Windows, | |
// where we need to convert '\' to '/' and add an extra '/' prefix before the | |
// drive letter. | |
var pathname = path.resolve(process.cwd(), fileName).replace(/\\/g, '/'); | |
if (pathname[0] !== '/') { | |
pathname = '/' + pathname; | |
} | |
return 'file://' + pathname; | |
}; | |
/** | |
* Define a setter on an object | |
* | |
* This method replaces any existing setter but leaves getters in place. | |
* | |
* - `object` {Object} the object to define the setter on | |
* - `property` {String} the name of the setter | |
* - `setterFn` {Function} the setter | |
*/ | |
exports.defineSetter = function defineSetter(object, property, setterFn) { | |
var descriptor = Object.getOwnPropertyDescriptor(object, property) || { | |
configurable: true, | |
enumerable: true | |
}; | |
descriptor.set = setterFn; | |
Object.defineProperty(object, property, descriptor); | |
}; | |
/** | |
* Define a getter on an object | |
* | |
* This method replaces any existing getter but leaves setters in place. | |
* | |
* - `object` {Object} the object to define the getter on | |
* - `property` {String} the name of the getter | |
* - `getterFn` {Function} the getter | |
*/ | |
exports.defineGetter = function defineGetter(object, property, getterFn) { | |
var descriptor = Object.getOwnPropertyDescriptor(object, property) || { | |
configurable: true, | |
enumerable: true | |
}; | |
descriptor.get = getterFn; | |
Object.defineProperty(object, property, descriptor); | |
}; | |
/** | |
* Create an object with the given prototype | |
* | |
* Optionally augment the created object. | |
* | |
* - `prototyp` {Object} the created object's prototype | |
* - `[properties]` {Object} properties to attach to the created object | |
*/ | |
exports.createFrom = function createFrom(prototype, properties) { | |
properties = properties || {}; | |
var descriptors = {}; | |
Object.getOwnPropertyNames(properties).forEach(function (name) { | |
descriptors[name] = Object.getOwnPropertyDescriptor(properties, name); | |
}); | |
return Object.create(prototype, descriptors); | |
}; | |
/** | |
* Create an inheritance relationship between two classes | |
* | |
* Optionally augment the inherited prototype. | |
* | |
* - `Superclass` {Function} the inherited class | |
* - `Subclass` {Function} the inheriting class | |
* - `[properties]` {Object} properties to attach to the inherited prototype | |
*/ | |
exports.inheritFrom = function inheritFrom(Superclass, Subclass, properties) { | |
properties = properties || {}; | |
Object.defineProperty(properties, 'constructor', { | |
value: Subclass, | |
writable: true, | |
configurable: true | |
}); | |
Subclass.prototype = exports.createFrom(Superclass.prototype, properties); | |
}; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! (webpack)/~/node-libs-browser/~/process/browser.js */ 13))) | |
/***/ }, | |
/* 4 */ | |
/*!*******************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/level2/style.js ***! | |
\*******************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var core = __webpack_require__(/*! ./core */ 22).dom.level2.core, | |
html = __webpack_require__(/*! ./html */ 5).dom.level2.html, | |
utils = __webpack_require__(/*! ../utils */ 3), | |
defineGetter = utils.defineGetter, | |
defineSetter = utils.defineSetter, | |
inheritFrom = utils.inheritFrom, | |
cssom = __webpack_require__(/*! cssom */ 40), | |
cssstyle = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"cssstyle\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())), | |
assert = __webpack_require__(/*! assert */ 38); | |
// What works now: | |
// - Accessing the rules defined in individual stylesheets | |
// - Modifications to style content attribute are reflected in style property | |
// - Modifications to style property are reflected in style content attribute | |
// TODO | |
// - Modifications to style element's textContent are reflected in sheet property. | |
// - Modifications to style element's sheet property are reflected in textContent. | |
// - Modifications to link.href property are reflected in sheet property. | |
// - Less-used features of link: disabled | |
// - Less-used features of style: disabled, scoped, title | |
// - CSSOM-View | |
// - getComputedStyle(): requires default stylesheet, cascading, inheritance, | |
// filtering by @media (screen? print?), layout for widths/heights | |
// - Load events are not in the specs, but apparently some browsers | |
// implement something. Should onload only fire after all @imports have been | |
// loaded, or only the primary sheet? | |
core.StyleSheet = cssom.StyleSheet; | |
core.MediaList = cssom.MediaList; | |
core.CSSStyleSheet = cssom.CSSStyleSheet; | |
core.CSSRule = cssom.CSSRule; | |
core.CSSStyleRule = cssom.CSSStyleRule; | |
core.CSSMediaRule = cssom.CSSMediaRule; | |
core.CSSImportRule = cssom.CSSImportRule; | |
core.CSSStyleDeclaration = cssstyle.CSSStyleDeclaration; | |
// Relavant specs | |
// http://www.w3.org/TR/DOM-Level-2-Style (2000) | |
// http://www.w3.org/TR/cssom-view/ (2008) | |
// http://dev.w3.org/csswg/cssom/ (2010) Meant to replace DOM Level 2 Style | |
// http://www.whatwg.org/specs/web-apps/current-work/multipage/ HTML5, of course | |
// http://dev.w3.org/csswg/css-style-attr/ not sure what's new here | |
// Objects that aren't in cssom library but should be: | |
// CSSRuleList (cssom just uses array) | |
// CSSFontFaceRule | |
// CSSPageRule | |
// These rules don't really make sense to implement, so CSSOM draft makes them | |
// obsolete. | |
// CSSCharsetRule | |
// CSSUnknownRule | |
// These objects are considered obsolete by CSSOM draft, although modern | |
// browsers implement them. | |
// CSSValue | |
// CSSPrimitiveValue | |
// CSSValueList | |
// RGBColor | |
// Rect | |
// Counter | |
// StyleSheetList - | |
// http://www.w3.org/TR/DOM-Level-2-Style/stylesheets.html#StyleSheets-StyleSheetList | |
// added a push method to help manage the length | |
core.StyleSheetList = function() { | |
this._length = 0; | |
}; | |
core.StyleSheetList.prototype = { | |
item: function (i) { | |
return this[i]; | |
}, | |
push: function (sheet) { | |
this[this._length] = sheet; | |
this._length++; | |
}, | |
get length() { | |
return this._length; | |
} | |
}; | |
defineGetter(core.Document.prototype, 'styleSheets', function() { | |
if (!this._styleSheets) { | |
this._styleSheets = new core.StyleSheetList(); | |
} | |
// TODO: each style and link element should register its sheet on creation | |
// and remove it on removal. | |
return this._styleSheets; | |
}); | |
/** | |
* @this {html.HTMLLinkElement|html.HTMLStyleElement} | |
* @param {string} url | |
* @param {cssom.CSSStyleSheet} sheet | |
* @see http://dev.w3.org/csswg/cssom/#requirements-on-user-agents-implementing0 | |
*/ | |
function fetchStylesheet(url, sheet) { | |
html.resourceLoader.load(this, url, function(data, filename) { | |
// TODO: abort if the content-type is not text/css, and the document is | |
// in strict mode | |
sheet.href = html.resourceLoader.resolve(this.ownerDocument, url); | |
evaluateStylesheet.call(this, data, sheet, url); | |
}); | |
} | |
/** | |
* @this {html.HTMLLinkElement|html.HTMLStyleElement} | |
* @param {string} data | |
* @param {cssom.CSSStyleSheet} sheet | |
* @param {string} baseUrl | |
*/ | |
function evaluateStylesheet(data, sheet, baseUrl) { | |
// this is the element | |
var newStyleSheet = cssom.parse(data); | |
var spliceArgs = newStyleSheet.cssRules; | |
spliceArgs.unshift(0, sheet.cssRules.length); | |
Array.prototype.splice.apply(sheet.cssRules, spliceArgs); | |
scanForImportRules.call(this, sheet.cssRules, baseUrl); | |
this.ownerDocument.styleSheets.push(sheet); | |
} | |
/** | |
* @this {html.HTMLLinkElement|html.HTMLStyleElement} | |
* @param {cssom.CSSStyleSheet} sheet | |
* @param {string} baseUrl | |
*/ | |
function scanForImportRules(cssRules, baseUrl) { | |
if (!cssRules) return; | |
for (var i = 0; i < cssRules.length; ++i) { | |
if (cssRules[i].cssRules) { | |
// @media rule: keep searching inside it. | |
scanForImportRules.call(this, cssRules[i].cssRules, baseUrl); | |
} else if (cssRules[i].href) { | |
// @import rule: fetch the resource and evaluate it. | |
// See http://dev.w3.org/csswg/cssom/#css-import-rule | |
// If loading of the style sheet fails its cssRules list is simply | |
// empty. I.e. an @import rule always has an associated style sheet. | |
fetchStylesheet.call(this, cssRules[i].href, this.sheet); | |
} | |
} | |
} | |
/** | |
* @param {string} data | |
* @param {cssstyle.CSSStyleDeclaration} style | |
*/ | |
function evaluateStyleAttribute(data) { | |
// this is the element. | |
} | |
/** | |
* Subclass of core.Attr that reflects the current cssText. | |
*/ | |
function StyleAttr(node, value) { | |
this._node = node; | |
core.Attr.call(this, node.ownerDocument, 'style'); | |
if (!this._node._ignoreValueOfStyleAttr) { | |
this.nodeValue = value; | |
} | |
} | |
inheritFrom(core.Attr, StyleAttr, { | |
get nodeValue() { | |
if (typeof this._node._style === 'string') { | |
return this._node._style; | |
} else { | |
return this._node.style.cssText; | |
} | |
}, | |
set nodeValue(value) { | |
this._node._style = value; | |
} | |
}); | |
/** | |
* Overwrite core.AttrNodeMap#setNamedItem to create a StyleAttr instance | |
* instead of a core.Attr if the name equals 'style'. | |
*/ | |
utils.intercept(core.AttributeList, '$setNode', function(_super, args, attr) { | |
if (attr.name == 'style') { | |
attr = new StyleAttr(this._parentNode, attr.nodeValue); | |
} | |
return _super.call(this, attr); | |
}); | |
/** | |
* Lazily create a CSSStyleDeclaration. | |
*/ | |
defineGetter(html.HTMLElement.prototype, 'style', function() { | |
if (typeof this._style === 'string') { | |
// currently, cssom's parse doesn't really work if you pass in | |
// {state: 'name'}, so instead we just build a dummy sheet. | |
var styleSheet = cssom.parse('dummy{' + this._style + '}'); | |
this._style = new cssstyle.CSSStyleDeclaration(); | |
if (styleSheet.cssRules.length > 0 && styleSheet.cssRules[0].style) { | |
var newStyle = styleSheet.cssRules[0].style; | |
for (var i = 0; i < newStyle.length; ++i) { | |
var prop = newStyle[i]; | |
this._style.setProperty( | |
prop, | |
newStyle.getPropertyValue(prop), | |
newStyle.getPropertyPriority(prop)); | |
} | |
} | |
} | |
if (!this._style) { | |
this._style = new cssstyle.CSSStyleDeclaration(); | |
} | |
if (!this.getAttributeNode('style')) { | |
// Tell the StyleAttr constructor to not overwrite this._style | |
this._ignoreValueOfStyleAttr = true; | |
this.setAttribute('style'); | |
this._ignoreValueOfStyleAttr = false; | |
} | |
return this._style; | |
}); | |
assert.equal(undefined, html.HTMLLinkElement._init); | |
html.HTMLLinkElement._init = function() { | |
this.addEventListener('DOMNodeInsertedIntoDocument', function() { | |
if (!/(?:[ \t\n\r\f]|^)stylesheet(?:[ \t\n\r\f]|$)/i.test(this.rel)) { | |
// rel is a space-separated list of tokens, and the original rel types | |
// are case-insensitive. | |
return; | |
} | |
if (this.href) { | |
fetchStylesheet.call(this, this.href, this.sheet); | |
} | |
}); | |
this.addEventListener('DOMNodeRemovedFromDocument', function() { | |
}); | |
}; | |
/** | |
* @this {HTMLStyleElement|HTMLLinkElement} | |
*/ | |
var getOrCreateSheet = function() { | |
if (!this._cssStyleSheet) { | |
this._cssStyleSheet = new cssom.CSSStyleSheet(); | |
} | |
return this._cssStyleSheet; | |
}; | |
defineGetter(html.HTMLLinkElement.prototype, 'sheet', getOrCreateSheet); | |
assert.equal(undefined, html.HTMLStyleElement._init); | |
html.HTMLStyleElement._init = function() { | |
//console.log('init style') | |
this.addEventListener('DOMNodeInsertedIntoDocument', function() { | |
//console.log('style inserted') | |
//console.log('sheet: ', this.sheet); | |
if (this.type && this.type !== 'text/css') { | |
//console.log('bad type: ' + this.type) | |
return; | |
} | |
var content = ''; | |
Array.prototype.forEach.call(this.childNodes, function (child) { | |
if (child.nodeType === child.TEXT_NODE) { // text node | |
content += child.nodeValue; | |
} | |
}); | |
evaluateStylesheet.call(this, content, this.sheet, this._ownerDocument.URL); | |
}); | |
}; | |
defineGetter(html.HTMLStyleElement.prototype, 'sheet', getOrCreateSheet); | |
exports.dom = { | |
level2 : { | |
html : html, | |
core : core | |
} | |
}; | |
/***/ }, | |
/* 5 */ | |
/*!******************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/level2/html.js ***! | |
\******************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var core = __webpack_require__(/*! ./core */ 22).dom.level2.core, | |
events = __webpack_require__(/*! ./events */ 23).dom.level2.events, | |
applyDocumentFeatures = __webpack_require__(/*! ../browser/documentfeatures */ 6).applyDocumentFeatures, | |
defineGetter = __webpack_require__(/*! ../utils */ 3).defineGetter, | |
defineSetter = __webpack_require__(/*! ../utils */ 3).defineSetter, | |
inheritFrom = __webpack_require__(/*! ../utils */ 3).inheritFrom, | |
URL = __webpack_require__(/*! url */ 11), | |
Path = __webpack_require__(/*! path */ 12), | |
fs = __webpack_require__(/*! fs */ 14), | |
http = __webpack_require__(/*! http */ 28), | |
https = __webpack_require__(/*! https */ 37); | |
// modify cloned instance for more info check: https://github.com/tmpvar/jsdom/issues/325 | |
core = Object.create(core); | |
// Setup the javascript language processor | |
core.languageProcessors = { | |
javascript : __webpack_require__(/*! ./languages/javascript */ 30).javascript | |
}; | |
// TODO its own package? Pull request to Node? | |
function resolveHref(baseUrl, href) { | |
if (baseUrl === resolveHref.memoizedUrl && resolveHref.cache && resolveHref.cache[href]) { | |
return resolveHref.cache[href]; | |
} | |
// When switching protocols, the path doesn't get canonicalized (i.e. .s and ..s are still left): | |
// https://github.com/joyent/node/issues/5453 | |
var intermediate = URL.resolve(baseUrl, href); | |
// This canonicalizes the path, at the cost of overwriting the hash. | |
var nextStep = URL.resolve(intermediate, '#'); | |
// So, insert the hash back in, if there was one. | |
var parsed = URL.parse(intermediate); | |
var fixed = nextStep.slice(0, -1) + (parsed.hash || ''); | |
// Finally, fix file:/// URLs on Windows, where Node removes their drive letters: | |
// https://github.com/joyent/node/issues/5452 | |
if (/^file\:\/\/\/[a-z]\:\//i.test(baseUrl) && /^file\:\/\/\//.test(fixed) && !/^file\:\/\/\/[a-z]\:\//i.test(fixed)) { | |
fixed = fixed.replace(/^file\:\/\/\//, baseUrl.substring(0, 11)); | |
} | |
if (baseUrl !== resolveHref.memoizedUrl) { | |
resolveHref.memoizedUrl = baseUrl; | |
resolveHref.cache = {}; | |
} | |
resolveHref.cache[href] = fixed; | |
return fixed; | |
} | |
core.resourceLoader = { | |
load: function(element, href, callback) { | |
var ownerImplementation = element._ownerDocument.implementation; | |
if (ownerImplementation.hasFeature('FetchExternalResources', element.tagName.toLowerCase())) { | |
var full = this.resolve(element._ownerDocument, href); | |
var url = URL.parse(full); | |
if (ownerImplementation.hasFeature('SkipExternalResources', full)) { | |
return false; | |
} | |
if (url.hostname) { | |
this.download(url, element._ownerDocument._cookie, element._ownerDocument._cookieDomain, this.baseUrl(element._ownerDocument), this.enqueue(element, callback, full)); | |
} | |
else { | |
this.readFile(url.pathname, this.enqueue(element, callback, full)); | |
} | |
} | |
}, | |
enqueue: function(element, callback, filename) { | |
var loader = this, | |
doc = element.nodeType === core.Node.DOCUMENT_NODE ? | |
element : | |
element._ownerDocument; | |
if (!doc._queue) { | |
return function() {}; | |
} | |
return doc._queue.push(function(err, data) { | |
var ev = doc.createEvent('HTMLEvents'); | |
if (!err) { | |
try { | |
callback.call(element, data, filename || doc.URL); | |
ev.initEvent('load', false, false); | |
} | |
catch(e) { | |
err = e; | |
} | |
} | |
if (err) { | |
ev.initEvent('error', false, false); | |
ev.error = err; | |
} | |
element.dispatchEvent(ev); | |
}); | |
}, | |
baseUrl: function(document) { | |
var baseElements = document.getElementsByTagName('base'); | |
var baseUrl = document.URL; | |
if (baseElements.length > 0) { | |
var baseHref = baseElements.item(0).href; | |
if (baseHref) { | |
baseUrl = resolveHref(baseUrl, baseHref); | |
} | |
} | |
return baseUrl; | |
}, | |
resolve: function(document, href) { | |
// if getAttribute returns null, there is no href | |
// lets resolve to an empty string (nulls are not expected farther up) | |
if (href === null) { | |
return ''; | |
} | |
var baseUrl = this.baseUrl(document); | |
return resolveHref(baseUrl, href); | |
}, | |
download: function(url, cookie, cookieDomain, referrer, callback) { | |
var path = url.pathname + (url.search || ''), | |
options = {'method': 'GET', 'host': url.hostname, 'path': path}, | |
request; | |
if (url.protocol === 'https:') { | |
options.port = url.port || 443; | |
request = https.request(options); | |
} else { | |
options.port = url.port || 80; | |
request = http.request(options); | |
} | |
// set header. | |
if (referrer) { | |
request.setHeader('Referer', referrer); | |
} | |
if (cookie) { | |
var host = url.host.split(':')[0]; | |
if (host.indexOf(cookieDomain, host.length - cookieDomain.length) !== -1) { | |
request.setHeader('cookie', cookie); | |
} | |
} | |
request.on('response', function (response) { | |
var data = ''; | |
function success () { | |
if ([301, 302, 303, 307].indexOf(response.statusCode) > -1) { | |
var redirect = URL.resolve(url, response.headers["location"]); | |
core.resourceLoader.download(URL.parse(redirect), cookie, cookieDomain, referrer, callback); | |
} else { | |
callback(null, data); | |
} | |
} | |
response.setEncoding('utf8'); | |
response.on('data', function (chunk) { | |
data += chunk.toString(); | |
}); | |
response.on('end', function() { | |
// According to node docs, 'close' can fire after 'end', but not | |
// vice versa. Remove 'close' listener so we don't call success twice. | |
response.removeAllListeners('close'); | |
success(); | |
}); | |
response.on('close', function (err) { | |
if (err) { | |
callback(err); | |
} else { | |
success(); | |
} | |
}); | |
}); | |
request.on('error', callback); | |
request.end(); | |
}, | |
readFile: function(url, callback) { | |
fs.readFile(url.replace(/^file:\/\//, "").replace(/^\/([a-z]):\//i, '$1:/').replace(/%20/g, ' '), 'utf8', callback); | |
} | |
}; | |
function define(elementClass, def) { | |
var tagName = def.tagName, | |
tagNames = def.tagNames || (tagName? [tagName] : []), | |
parentClass = def.parentClass || core.HTMLElement, | |
attrs = def.attributes || [], | |
proto = def.proto || {}; | |
var elem = core[elementClass] = function(document, name) { | |
parentClass.call(this, document, name || tagName.toUpperCase()); | |
if (elem._init) { | |
elem._init.call(this); | |
} | |
}; | |
elem._init = def.init; | |
inheritFrom(parentClass, elem, proto); | |
attrs.forEach(function(n) { | |
var prop = n.prop || n, | |
attr = n.attr || prop.toLowerCase(); | |
if (!n.prop || n.read !== false) { | |
defineGetter(elem.prototype, prop, function() { | |
var s = this.getAttribute(attr); | |
if (n.type && n.type === 'boolean') { | |
return s !== null; | |
} | |
if (n.type && n.type === 'long') { | |
return +s; | |
} | |
if (typeof n === 'object' && n.normalize) { // see GH-491 | |
return n.normalize(s); | |
} | |
if (s === null) { | |
s = ''; | |
} | |
return s; | |
}); | |
} | |
if (!n.prop || n.write !== false) { | |
defineSetter(elem.prototype, prop, function(val) { | |
if (!val) { | |
this.removeAttribute(attr); | |
} | |
else { | |
var s = val.toString(); | |
if (typeof n === 'object' && n.normalize) { | |
s = n.normalize(s); | |
} | |
this.setAttribute(attr, s); | |
} | |
}); | |
} | |
}); | |
tagNames.forEach(function(tag) { | |
core.Document.prototype._elementBuilders[tag.toLowerCase()] = function(doc, s) { | |
var el = new elem(doc, s); | |
if (def.elementBuilder) { | |
return def.elementBuilder(el, doc, s); | |
} | |
return el; | |
}; | |
}); | |
} | |
core.HTMLCollection = function HTMLCollection(element, query) { | |
this._keys = []; | |
core.NodeList.call(this, element, query); | |
}; | |
inheritFrom(core.NodeList, core.HTMLCollection, { | |
namedItem: function(name) { | |
// Try property shortcut; should work in most cases | |
if (Object.prototype.hasOwnProperty.call(this, name)) { | |
return this[name]; | |
} | |
var results = this._toArray(), | |
l = results.length, | |
node, | |
matchingName = null; | |
for (var i=0; i<l; i++) { | |
node = results[i]; | |
if (node.getAttribute('id') === name) { | |
return node; | |
} else if (node.getAttribute('name') === name) { | |
matchingName = node; | |
} | |
} | |
return matchingName; | |
}, | |
toString: function() { | |
return '[ jsdom HTMLCollection ]: contains ' + this.length + ' items'; | |
}, | |
_resetTo: function(array) { | |
var i, _this = this; | |
for (i = 0; i < this._keys.length; ++i) { | |
delete this[this._keys[i]]; | |
} | |
this._keys = []; | |
core.NodeList.prototype._resetTo.apply(this, arguments); | |
function testAttr(node, attr) { | |
var val = node.getAttribute(attr); | |
if (val && !Object.prototype.hasOwnProperty.call(_this, val)) { | |
_this[val] = node; | |
_this._keys.push(val); | |
} | |
} | |
for (i = 0; i < array.length; ++i) { | |
testAttr(array[i], 'id'); | |
} | |
for (i = 0; i < array.length; ++i) { | |
testAttr(array[i], 'name'); | |
} | |
} | |
}); | |
Object.defineProperty(core.HTMLCollection.prototype, 'constructor', { | |
value: core.NodeList, | |
writable: true, | |
configurable: true | |
}); | |
core.HTMLOptionsCollection = core.HTMLCollection; | |
function closest(e, tagName) { | |
tagName = tagName.toUpperCase(); | |
while (e) { | |
if (e.nodeName.toUpperCase() === tagName || | |
(e.tagName && e.tagName.toUpperCase() === tagName)) | |
{ | |
return e; | |
} | |
e = e._parentNode; | |
} | |
return null; | |
} | |
function descendants(e, tagName, recursive) { | |
var owner = recursive ? e._ownerDocument || e : e; | |
return new core.HTMLCollection(owner, core.mapper(e, function(n) { | |
return n.nodeName === tagName && typeof n._publicId == 'undefined'; | |
}, recursive)); | |
} | |
function firstChild(e, tagName) { | |
if (!e) { | |
return null; | |
} | |
var c = descendants(e, tagName, false); | |
return c.length > 0 ? c[0] : null; | |
} | |
function ResourceQueue(paused) { | |
this.paused = !!paused; | |
} | |
ResourceQueue.prototype = { | |
push: function(callback) { | |
var q = this; | |
var item = { | |
prev: q.tail, | |
check: function() { | |
if (!q.paused && !this.prev && this.fired){ | |
callback(this.err, this.data); | |
if (this.next) { | |
this.next.prev = null; | |
this.next.check(); | |
}else{//q.tail===this | |
q.tail = null; | |
} | |
} | |
} | |
}; | |
if (q.tail) { | |
q.tail.next = item; | |
} | |
q.tail = item; | |
return function(err, data) { | |
item.fired = 1; | |
item.err = err; | |
item.data = data; | |
item.check(); | |
}; | |
}, | |
resume: function() { | |
if(!this.paused){ | |
return; | |
} | |
this.paused = false; | |
var head = this.tail; | |
while(head && head.prev){ | |
head = head.prev; | |
} | |
if(head){ | |
head.check(); | |
} | |
} | |
}; | |
core.HTMLDocument = function HTMLDocument(options) { | |
options = options || {}; | |
if (!options.contentType) { | |
options.contentType = 'text/html'; | |
} | |
core.Document.call(this, options); | |
this._referrer = options.referrer; | |
this._cookie = options.cookie; | |
this._cookieDomain = options.cookieDomain || '127.0.0.1'; | |
this._URL = options.url || '/'; | |
this._documentRoot = options.documentRoot || Path.dirname(this._URL); | |
this._queue = new ResourceQueue(options.deferClose); | |
this.readyState = 'loading'; | |
// Add level2 features | |
this.implementation.addFeature('core' , '2.0'); | |
this.implementation.addFeature('html' , '2.0'); | |
this.implementation.addFeature('xhtml' , '2.0'); | |
this.implementation.addFeature('xml' , '2.0'); | |
}; | |
inheritFrom(core.Document, core.HTMLDocument, { | |
_referrer : "", | |
get referrer() { | |
return this._referrer || ''; | |
}, | |
get domain() { | |
return ""; | |
}, | |
_URL : "", | |
get URL() { | |
return this._URL; | |
}, | |
get images() { | |
return this.getElementsByTagName('IMG'); | |
}, | |
get applets() { | |
return new core.HTMLCollection(this, core.mapper(this, function(el) { | |
if (el && el.tagName) { | |
var upper = el.tagName.toUpperCase(); | |
if (upper === "APPLET") { | |
return true; | |
} else if (upper === "OBJECT" && | |
el.getElementsByTagName('APPLET').length > 0) | |
{ | |
return true; | |
} | |
} | |
})); | |
}, | |
get links() { | |
return new core.HTMLCollection(this, core.mapper(this, function(el) { | |
if (el && el.tagName) { | |
var upper = el.tagName.toUpperCase(); | |
if (upper === "AREA" || (upper === "A" && el.href)) { | |
return true; | |
} | |
} | |
})); | |
}, | |
get forms() { | |
return this.getElementsByTagName('FORM'); | |
}, | |
get anchors() { | |
return this.getElementsByTagName('A'); | |
}, | |
open : function() { | |
this._childNodes = new core.NodeList(); | |
this._documentElement = null; | |
this._modified(); | |
}, | |
close : function() { | |
this._queue.resume(); | |
// Set the readyState to 'complete' once all resources are loaded. | |
// As a side-effect the document's load-event will be dispatched. | |
core.resourceLoader.enqueue(this, function() { | |
this.readyState = 'complete'; | |
var ev = this.createEvent('HTMLEvents'); | |
ev.initEvent('DOMContentLoaded', false, false); | |
this.dispatchEvent(ev); | |
})(null, true); | |
}, | |
// document.write is defined in browser/index.js. | |
writeln : function(text) { | |
this.write(text + '\n'); | |
}, | |
getElementsByName : function(elementName) { | |
return new core.HTMLCollection(this, core.mapper(this, function(el) { | |
return (el.getAttribute && el.getAttribute("name") === elementName); | |
})); | |
}, | |
get title() { | |
var head = this.head, | |
title = head ? firstChild(head, 'TITLE') : null; | |
return title ? title.textContent : ''; | |
}, | |
set title(val) { | |
var title = firstChild(this.head, 'TITLE'); | |
if (!title) { | |
title = this.createElement('TITLE'); | |
var head = this.head; | |
if (!head) { | |
head = this.createElement('HEAD'); | |
this.documentElement.insertBefore(head, this.documentElement.firstChild); | |
} | |
head.appendChild(title); | |
} | |
title.textContent = val; | |
}, | |
get head() { | |
return firstChild(this.documentElement, 'HEAD'); | |
}, | |
set head(unused) { /* noop */ }, | |
get body() { | |
var body = firstChild(this.documentElement, 'BODY'); | |
if (!body) { | |
body = firstChild(this.documentElement, 'FRAMESET'); | |
} | |
return body; | |
}, | |
get documentElement() { | |
if (!this._documentElement) { | |
this._documentElement = firstChild(this, 'HTML'); | |
} | |
return this._documentElement; | |
}, | |
_cookie : "", | |
get cookie() { | |
var cookies = Array.isArray(this._cookie) ? | |
this._cookie : | |
(this._cookie && this._cookie.length > 0 ? [this._cookie] : []); | |
return cookies.map(function (x) { | |
return x.split(';')[0]; | |
}).join('; '); | |
}, | |
set cookie(val) { | |
if (val == null) return val; | |
var key = val.split('=')[0]; | |
var cookies = Array.isArray(this._cookie) ? | |
this._cookie : | |
(this._cookie && this._cookie.length > 0 ? [this._cookie] : []); | |
for (var i = 0; i < cookies.length; i++) { | |
if (cookies[i].lastIndexOf(key + '=', 0) === 0) { | |
cookies[i] = val; | |
key = null; | |
break; | |
} | |
} | |
if (key) { | |
cookies.push(val); | |
} | |
if (cookies.length === 1) { | |
this._cookie = cookies[0]; | |
} else { | |
this._cookie = cookies; | |
} | |
return val; | |
} | |
}); | |
define('HTMLElement', { | |
parentClass: core.Element, | |
proto : { | |
// Add default event behavior (click link to navigate, click button to submit | |
// form, etc). We start by wrapping dispatchEvent so we can forward events to | |
// the element's _eventDefault function (only events that did not incur | |
// preventDefault). | |
dispatchEvent : function (event) { | |
var outcome = core.Node.prototype.dispatchEvent.call(this, event) | |
if (!event._preventDefault && | |
event.target._eventDefaults[event.type] && | |
typeof event.target._eventDefaults[event.type] === 'function') | |
{ | |
event.target._eventDefaults[event.type](event) | |
} | |
return outcome; | |
}, | |
getBoundingClientRect: function () { | |
return { | |
bottom: 0, | |
height: 0, | |
left: 0, | |
right: 0, | |
top: 0, | |
width: 0 | |
}; | |
}, | |
_eventDefaults : {} | |
}, | |
attributes: [ | |
'id', | |
'title', | |
'lang', | |
'dir', | |
{prop: 'className', attr: 'class', normalize: function(s) { return s || ''; }} | |
] | |
}); | |
core.Document.prototype._defaultElementBuilder = function(document, tagName) { | |
return new core.HTMLElement(document, tagName); | |
}; | |
// http://www.whatwg.org/specs/web-apps/current-work/#category-listed | |
var listedElements = /button|fieldset|input|keygen|object|select|textarea/i; | |
define('HTMLFormElement', { | |
tagName: 'FORM', | |
proto: { | |
get elements() { | |
return new core.HTMLCollection(this._ownerDocument, core.mapper(this, function(e) { | |
return listedElements.test(e.nodeName) ; // TODO exclude <input type="image"> | |
})); | |
}, | |
get length() { | |
return this.elements.length; | |
}, | |
_dispatchSubmitEvent: function() { | |
var ev = this._ownerDocument.createEvent('HTMLEvents'); | |
ev.initEvent('submit', true, true); | |
if (!this.dispatchEvent(ev)) { | |
this.submit(); | |
}; | |
}, | |
submit: function() { | |
}, | |
reset: function() { | |
this.elements._toArray().forEach(function(el) { | |
el.value = el.defaultValue; | |
}); | |
} | |
}, | |
attributes: [ | |
'name', | |
{prop: 'acceptCharset', attr: 'accept-charset'}, | |
'action', | |
'enctype', | |
'method', | |
'target' | |
] | |
}); | |
define('HTMLLinkElement', { | |
tagName: 'LINK', | |
proto: { | |
get href() { | |
return core.resourceLoader.resolve(this._ownerDocument, this.getAttribute('href')); | |
} | |
}, | |
attributes: [ | |
{prop: 'disabled', type: 'boolean'}, | |
'charset', | |
'href', | |
'hreflang', | |
'media', | |
'rel', | |
'rev', | |
'target', | |
'type' | |
] | |
}); | |
define('HTMLMetaElement', { | |
tagName: 'META', | |
attributes: [ | |
'content', | |
{prop: 'httpEquiv', attr: 'http-equiv'}, | |
'name', | |
'scheme' | |
] | |
}); | |
define('HTMLHtmlElement', { | |
tagName: 'HTML', | |
attributes: [ | |
'version' | |
] | |
}); | |
define('HTMLHeadElement', { | |
tagName: 'HEAD', | |
attributes: [ | |
'profile' | |
] | |
}); | |
define('HTMLTitleElement', { | |
tagName: 'TITLE', | |
proto: { | |
get text() { | |
return this.innerHTML; | |
}, | |
set text(s) { | |
this.innerHTML = s; | |
} | |
} | |
}); | |
define('HTMLBaseElement', { | |
tagName: 'BASE', | |
attributes: [ | |
'href', | |
'target' | |
] | |
}); | |
//**Deprecated** | |
define('HTMLIsIndexElement', { | |
tagName : 'ISINDEX', | |
parentClass : core.Element, | |
proto : { | |
get form() { | |
return closest(this, 'FORM'); | |
} | |
}, | |
attributes : [ | |
'prompt' | |
] | |
}); | |
define('HTMLStyleElement', { | |
tagName: 'STYLE', | |
attributes: [ | |
{prop: 'disabled', type: 'boolean'}, | |
'media', | |
'type', | |
] | |
}); | |
define('HTMLBodyElement', { | |
proto: (function() { | |
var proto = {}; | |
// The body element's "traditional" event handlers are proxied to the | |
// window object. | |
// See: http://www.whatwg.org/specs/web-apps/current-work/#the-body-element | |
['onafterprint', 'onbeforeprint', 'onbeforeunload', 'onblur', 'onerror', | |
'onfocus', 'onhashchange', 'onload', 'onmessage', 'onoffline', 'ononline', | |
'onpagehide', 'onpageshow', 'onpopstate', 'onresize', 'onscroll', | |
'onstorage', 'onunload'].forEach(function (name) { | |
defineSetter(proto, name, function (handler) { | |
this._ownerDocument.parentWindow[name] = handler; | |
}); | |
defineGetter(proto, name, function () { | |
return this._ownerDocument.parentWindow[name]; | |
}); | |
}); | |
return proto; | |
})(), | |
tagName: 'BODY', | |
attributes: [ | |
'aLink', | |
'background', | |
'bgColor', | |
'link', | |
'text', | |
'vLink' | |
] | |
}); | |
define('HTMLSelectElement', { | |
tagName: 'SELECT', | |
proto: { | |
get options() { | |
return new core.HTMLOptionsCollection(this, core.mapper(this, function(n) { | |
return n.nodeName === 'OPTION'; | |
})); | |
}, | |
get length() { | |
return this.options.length; | |
}, | |
get selectedIndex() { | |
return this.options._toArray().reduceRight(function(prev, option, i) { | |
return option.selected ? i : prev; | |
}, -1); | |
}, | |
set selectedIndex(index) { | |
this.options._toArray().forEach(function(option, i) { | |
option.selected = i === index; | |
}); | |
}, | |
get value() { | |
var i = this.selectedIndex; | |
if (this.options.length && (i === -1)) { | |
i = 0; | |
} | |
if (i === -1) { | |
return ''; | |
} | |
return this.options[i].value; | |
}, | |
set value(val) { | |
var self = this; | |
this.options._toArray().forEach(function(option) { | |
if (option.value === val) { | |
option.selected = true; | |
} else { | |
if (!self.hasAttribute('multiple')) { | |
// Remove the selected bit from all other options in this group | |
// if the multiple attr is not present on the select | |
option.selected = false; | |
} | |
} | |
}); | |
}, | |
get form() { | |
return closest(this, 'FORM'); | |
}, | |
get type() { | |
return this.multiple ? 'select-multiple' : 'select-one'; | |
}, | |
add: function(opt, before) { | |
if (before) { | |
this.insertBefore(opt, before); | |
} | |
else { | |
this.appendChild(opt); | |
} | |
}, | |
remove: function(index) { | |
var opts = this.options._toArray(); | |
if (index >= 0 && index < opts.length) { | |
var el = opts[index]; | |
el._parentNode.removeChild(el); | |
} | |
}, | |
blur : function() { | |
this._ownerDocument.activeElement = this._ownerDocument.body; | |
}, | |
focus : function() { | |
this._ownerDocument.activeElement = this; | |
} | |
}, | |
attributes: [ | |
{prop: 'disabled', type: 'boolean'}, | |
{prop: 'multiple', type: 'boolean'}, | |
'name', | |
{prop: 'size', type: 'long'}, | |
{prop: 'tabIndex', type: 'long'}, | |
] | |
}); | |
define('HTMLOptGroupElement', { | |
tagName: 'OPTGROUP', | |
attributes: [ | |
{prop: 'disabled', type: 'boolean'}, | |
'label' | |
] | |
}); | |
define('HTMLOptionElement', { | |
tagName: 'OPTION', | |
proto: { | |
_attrModified: function(name, value) { | |
if (name === 'selected') { | |
this.selected = this.defaultSelected; | |
} | |
core.HTMLElement.prototype._attrModified.call(this, arguments); | |
}, | |
get form() { | |
return closest(this, 'FORM'); | |
}, | |
get defaultSelected() { | |
return this.getAttribute('selected') !== null; | |
}, | |
set defaultSelected(s) { | |
if (s) this.setAttribute('selected', 'selected'); | |
else this.removeAttribute('selected'); | |
}, | |
get text() { | |
return this.innerHTML; | |
}, | |
get value() { | |
return (this.hasAttribute('value')) ? this.getAttribute('value') : this.innerHTML; | |
}, | |
set value(val) { | |
this.setAttribute('value', val); | |
}, | |
get index() { | |
return closest(this, 'SELECT').options._toArray().indexOf(this); | |
}, | |
get selected() { | |
if (this._selected === undefined) { | |
this._selected = this.defaultSelected; | |
} | |
if (!this._selected && this.parentNode) { | |
var select = closest(this, 'SELECT'); | |
if (select) { | |
var options = select.options; | |
if (options.item(0) === this && !select.hasAttribute('multiple')) { | |
var found = false, optArray = options._toArray(); | |
for (var i = 1, l = optArray.length; i<l; i++) { | |
if (optArray[i]._selected) { | |
return false; | |
} | |
} | |
return true; | |
} | |
} | |
} | |
return this._selected; | |
}, | |
set selected(s) { | |
// TODO: The 'selected' content attribute is the initial value of the | |
// IDL attribute, but the IDL attribute should not relfect the content | |
this._selected = !!s; | |
if (s) { | |
//Remove the selected bit from all other options in this select | |
var select = this._parentNode; | |
if (!select) return; | |
if (select.nodeName !== 'SELECT') { | |
select = select._parentNode; | |
if (!select) return; | |
if (select.nodeName !== 'SELECT') return; | |
} | |
if (!select.multiple) { | |
var o = select.options; | |
for (var i = 0; i < o.length; i++) { | |
if (o[i] !== this) { | |
o[i].selected = false; | |
} | |
} | |
} | |
} | |
} | |
}, | |
attributes: [ | |
{prop: 'disabled', type: 'boolean'}, | |
'label' | |
] | |
}); | |
define('HTMLInputElement', { | |
tagName: 'INPUT', | |
init: function() { | |
if (!this.type) { | |
this.type = 'text'; | |
} | |
}, | |
proto: { | |
_value: null, | |
_initDefaultChecked: function() { | |
if (this._defaultChecked === undefined) { | |
this._defaultChecked = !!this.getAttribute('checked'); | |
} | |
return this._defaultChecked; | |
}, | |
get form() { | |
return closest(this, 'FORM'); | |
}, | |
get defaultValue() { | |
var val = this.getAttribute('value'); | |
return val !== null ? val : ""; | |
}, | |
set defaultValue(val) { | |
this.setAttribute('value', String(val)); | |
}, | |
get defaultChecked() { | |
return this._initDefaultChecked(); | |
}, | |
get checked() { | |
return !!this._attributes.getNamedItem('checked'); | |
}, | |
set checked(checked) { | |
this._initDefaultChecked(); | |
if (checked) { | |
this.setAttribute('checked', 'checked'); | |
if (this.type === 'radio') { | |
var elements = this._ownerDocument.getElementsByName(this.name); | |
for (var i = 0; i < elements.length; i++) { | |
if (elements[i] !== this && elements[i].tagName === "INPUT" && elements[i].type === "radio" && elements[i].form === this.form) { | |
elements[i].checked = false; | |
} | |
} | |
} | |
} else { | |
this.removeAttribute('checked'); | |
} | |
}, | |
get value() { | |
return this._value !== null ? this._value : this.defaultValue; | |
}, | |
set value(val) { | |
if (val === null) { | |
this._value = null; | |
return; | |
} else { | |
this._value = String(val); | |
} | |
}, | |
get type() { | |
var type = this.getAttribute('type'); | |
return type ? type : 'text'; | |
}, | |
set type(type) { | |
this.setAttribute('type', type); | |
}, | |
blur : function() { | |
this._ownerDocument.activeElement = this._ownerDocument.body; | |
}, | |
focus : function() { | |
this._ownerDocument.activeElement = this; | |
}, | |
select: function() { | |
}, | |
_dispatchClickEvent: function() { | |
var event = this._ownerDocument.createEvent("HTMLEvents"); | |
event.initEvent("click", true, true); | |
this.dispatchEvent(event); | |
}, | |
click: function() { | |
if (this.type === 'checkbox') { | |
this.checked = !this.checked; | |
} | |
else if (this.type === 'radio') { | |
this.checked = true; | |
} | |
else if (this.type === 'submit') { | |
var form = this.form; | |
if (form) { | |
form._dispatchSubmitEvent(); | |
} | |
} | |
this._dispatchClickEvent(); | |
} | |
}, | |
attributes: [ | |
'accept', | |
'accessKey', | |
'align', | |
'alt', | |
{prop: 'disabled', type: 'boolean'}, | |
{prop: 'maxLength', type: 'long'}, | |
'name', | |
{prop: 'readOnly', type: 'boolean'}, | |
{prop: 'size', type: 'long'}, | |
'src', | |
{prop: 'tabIndex', type: 'long'}, | |
{prop: 'type', normalize: function(val) { | |
return val ? val.toLowerCase() : 'text'; | |
}}, | |
'useMap' | |
] | |
}); | |
define('HTMLTextAreaElement', { | |
tagName: 'TEXTAREA', | |
proto: { | |
_initDefaultValue: function() { | |
if (this._defaultValue === undefined) { | |
this._defaultValue = this.textContent; | |
} | |
return this._defaultValue; | |
}, | |
get form() { | |
return closest(this, 'FORM'); | |
}, | |
get defaultValue() { | |
return this._initDefaultValue(); | |
}, | |
get value() { | |
return this.textContent; | |
}, | |
set value(val) { | |
this._initDefaultValue(); | |
this.textContent = val; | |
}, | |
get type() { | |
return 'textarea'; | |
}, | |
blur : function() { | |
this._ownerDocument.activeElement = this._ownerDocument.body; | |
}, | |
focus : function() { | |
this._ownerDocument.activeElement = this; | |
}, | |
select: function() { | |
} | |
}, | |
attributes: [ | |
'accessKey', | |
{prop: 'cols', type: 'long'}, | |
{prop: 'disabled', type: 'boolean'}, | |
{prop: 'maxLength', type: 'long'}, | |
'name', | |
{prop: 'readOnly', type: 'boolean'}, | |
{prop: 'rows', type: 'long'}, | |
{prop: 'tabIndex', type: 'long'} | |
] | |
}); | |
define('HTMLButtonElement', { | |
tagName: 'BUTTON', | |
proto: { | |
get form() { | |
return closest(this, 'FORM'); | |
}, | |
focus : function() { | |
this._ownerDocument.activeElement = this; | |
}, | |
blur : function() { | |
this._ownerDocument.activeElement = this._ownerDocument.body; | |
} | |
}, | |
attributes: [ | |
'accessKey', | |
{prop: 'disabled', type: 'boolean'}, | |
'name', | |
{prop: 'tabIndex', type: 'long'}, | |
'type', | |
'value' | |
] | |
}); | |
define('HTMLLabelElement', { | |
tagName: 'LABEL', | |
proto: { | |
get form() { | |
return closest(this, 'FORM'); | |
} | |
}, | |
attributes: [ | |
'accessKey', | |
{prop: 'htmlFor', attr: 'for'} | |
] | |
}); | |
define('HTMLFieldSetElement', { | |
tagName: 'FIELDSET', | |
proto: { | |
get form() { | |
return closest(this, 'FORM'); | |
} | |
} | |
}); | |
define('HTMLLegendElement', { | |
tagName: 'LEGEND', | |
proto: { | |
get form() { | |
return closest(this, 'FORM'); | |
} | |
}, | |
attributes: [ | |
'accessKey', | |
'align' | |
] | |
}); | |
define('HTMLUListElement', { | |
tagName: 'UL', | |
attributes: [ | |
{prop: 'compact', type: 'boolean'}, | |
'type' | |
] | |
}); | |
define('HTMLOListElement', { | |
tagName: 'OL', | |
attributes: [ | |
{prop: 'compact', type: 'boolean'}, | |
{prop: 'start', type: 'long'}, | |
'type' | |
] | |
}); | |
define('HTMLDListElement', { | |
tagName: 'DL', | |
attributes: [ | |
{prop: 'compact', type: 'boolean'} | |
] | |
}); | |
define('HTMLDirectoryElement', { | |
tagName: 'DIR', | |
attributes: [ | |
{prop: 'compact', type: 'boolean'} | |
] | |
}); | |
define('HTMLMenuElement', { | |
tagName: 'MENU', | |
attributes: [ | |
{prop: 'compact', type: 'boolean'} | |
] | |
}); | |
define('HTMLLIElement', { | |
tagName: 'LI', | |
attributes: [ | |
'type', | |
{prop: 'value', type: 'long'} | |
] | |
}); | |
define('HTMLCanvasElement', { | |
tagName: 'CANVAS', | |
attributes: [ | |
'align' | |
], | |
elementBuilder: function (element) { | |
// require node-canvas and catch the error if it blows up | |
try { | |
var canvas = new (__webpack_require__(/*! canvas */ 15))(0,0); | |
for (var attr in element) { | |
if (!canvas[attr]) { | |
canvas[attr] = element[attr]; | |
} | |
} | |
return canvas; | |
} catch (e) { | |
return element; | |
} | |
} | |
}); | |
define('HTMLDivElement', { | |
tagName: 'DIV', | |
attributes: [ | |
'align' | |
] | |
}); | |
define('HTMLParagraphElement', { | |
tagName: 'P', | |
attributes: [ | |
'align' | |
] | |
}); | |
define('HTMLHeadingElement', { | |
tagNames: ['H1','H2','H3','H4','H5','H6'], | |
attributes: [ | |
'align' | |
] | |
}); | |
define('HTMLQuoteElement', { | |
tagNames: ['Q','BLOCKQUOTE'], | |
attributes: [ | |
'cite' | |
] | |
}); | |
define('HTMLPreElement', { | |
tagName: 'PRE', | |
attributes: [ | |
{prop: 'width', type: 'long'} | |
] | |
}); | |
define('HTMLBRElement', { | |
tagName: 'BR', | |
attributes: [ | |
'clear' | |
] | |
}); | |
define('HTMLBaseFontElement', { | |
tagName: 'BASEFONT', | |
attributes: [ | |
'color', | |
'face', | |
{prop: 'size', type: 'long'} | |
] | |
}); | |
define('HTMLFontElement', { | |
tagName: 'FONT', | |
attributes: [ | |
'color', | |
'face', | |
'size' | |
] | |
}); | |
define('HTMLHRElement', { | |
tagName: 'HR', | |
attributes: [ | |
'align', | |
{prop: 'noShade', type: 'boolean'}, | |
'size', | |
'width' | |
] | |
}); | |
define('HTMLModElement', { | |
tagNames: ['INS', 'DEL'], | |
attributes: [ | |
'cite', | |
'dateTime' | |
] | |
}); | |
define('HTMLAnchorElement', { | |
tagName: 'A', | |
proto: { | |
blur : function() { | |
this._ownerDocument.activeElement = this._ownerDocument.body; | |
}, | |
focus : function() { | |
this._ownerDocument.activeElement = this; | |
}, | |
get href() { | |
return core.resourceLoader.resolve(this._ownerDocument, this.getAttribute('href')); | |
}, | |
get hostname() { | |
return URL.parse(this.href).hostname || ''; | |
}, | |
get host() { | |
return URL.parse(this.href).host || ''; | |
}, | |
get origin() { | |
var proto = URL.parse(this.href).protocol; | |
if (proto !== undefined && proto !== null) { | |
proto += '//'; | |
} | |
return proto + URL.parse(this.href).host || ''; | |
}, | |
get port() { | |
return URL.parse(this.href).port || ''; | |
}, | |
get protocol() { | |
var protocol = URL.parse(this.href).protocol; | |
return (protocol == null) ? ':' : protocol; | |
}, | |
get password() { | |
var auth = URL.parse(this.href).auth; | |
return auth.substr(auth.indexOf(':') + 1); | |
}, | |
get pathname() { | |
return URL.parse(this.href).pathname || ''; | |
}, | |
get username() { | |
var auth = URL.parse(this.href).auth; | |
return auth.substr(0, auth.indexOf(':')); | |
}, | |
get search() { | |
return URL.parse(this.href).search || ''; | |
}, | |
get hash() { | |
return URL.parse(this.href).hash || ''; | |
} | |
}, | |
attributes: [ | |
'accessKey', | |
'charset', | |
'coords', | |
{prop: 'href', type: 'string', read: false}, | |
'hreflang', | |
'name', | |
'rel', | |
'rev', | |
'shape', | |
{prop: 'tabIndex', type: 'long'}, | |
'target', | |
'type' | |
] | |
}); | |
define('HTMLImageElement', { | |
tagName: 'IMG', | |
proto: { | |
_attrModified: function(name, value, oldVal) { | |
if (name == 'src' && value !== oldVal) { | |
core.resourceLoader.enqueue(this, function() {})(); | |
} | |
}, | |
get src() { | |
return core.resourceLoader.resolve(this._ownerDocument, this.getAttribute('src')); | |
} | |
}, | |
attributes: [ | |
'name', | |
'align', | |
'alt', | |
'border', | |
{prop: 'height', type: 'long'}, | |
{prop: 'hspace', type: 'long'}, | |
{prop: 'isMap', type: 'boolean'}, | |
'longDesc', | |
{prop: 'src', type: 'string', read: false}, | |
'useMap', | |
{prop: 'vspace', type: 'long'}, | |
{prop: 'width', type: 'long'} | |
] | |
}); | |
define('HTMLObjectElement', { | |
tagName: 'OBJECT', | |
proto: { | |
get form() { | |
return closest(this, 'FORM'); | |
}, | |
get contentDocument() { | |
return null; | |
} | |
}, | |
attributes: [ | |
'code', | |
'align', | |
'archive', | |
'border', | |
'codeBase', | |
'codeType', | |
'data', | |
{prop: 'declare', type: 'boolean'}, | |
{prop: 'height', type: 'long'}, | |
{prop: 'hspace', type: 'long'}, | |
'name', | |
'standby', | |
{prop: 'tabIndex', type: 'long'}, | |
'type', | |
'useMap', | |
{prop: 'vspace', type: 'long'}, | |
{prop: 'width', type: 'long'} | |
] | |
}); | |
define('HTMLParamElement', { | |
tagName: 'PARAM', | |
attributes: [ | |
'name', | |
'type', | |
'value', | |
'valueType' | |
] | |
}); | |
define('HTMLAppletElement', { | |
tagName: 'APPLET', | |
attributes: [ | |
'align', | |
'alt', | |
'archive', | |
'code', | |
'codeBase', | |
'height', | |
{prop: 'hspace', type: 'long'}, | |
'name', | |
'object', | |
{prop: 'vspace', type: 'long'}, | |
'width' | |
] | |
}); | |
define('HTMLMapElement', { | |
tagName: 'MAP', | |
proto: { | |
get areas() { | |
return this.getElementsByTagName("AREA"); | |
} | |
}, | |
attributes: [ | |
'name' | |
] | |
}); | |
define('HTMLAreaElement', { | |
tagName: 'AREA', | |
attributes: [ | |
'accessKey', | |
'alt', | |
'coords', | |
'href', | |
{prop: 'noHref', type: 'boolean'}, | |
'shape', | |
{prop: 'tabIndex', type: 'long'}, | |
'target' | |
] | |
}); | |
define('HTMLScriptElement', { | |
tagName: 'SCRIPT', | |
init: function() { | |
this.addEventListener('DOMNodeInsertedIntoDocument', function() { | |
if (this.src) { | |
core.resourceLoader.load(this, this.src, this._eval); | |
} | |
else { | |
var src = this.sourceLocation || {}, | |
filename = src.file || this._ownerDocument.URL; | |
if (src) { | |
filename += ':' + src.line + ':' + src.col; | |
} | |
filename += '<script>'; | |
core.resourceLoader.enqueue(this, this._eval, filename)(null, this.text); | |
} | |
}); | |
}, | |
proto: { | |
_eval: function(text, filename) { | |
if (this._ownerDocument.implementation.hasFeature("ProcessExternalResources", "script") && | |
this.language && | |
core.languageProcessors[this.language]) | |
{ | |
this._ownerDocument._writeAfterElement = this; | |
core.languageProcessors[this.language](this, text, filename); | |
delete this._ownerDocument._writeAfterElement; | |
} | |
}, | |
get language() { | |
var type = this.type || "text/javascript"; | |
return type.split("/").pop().toLowerCase(); | |
}, | |
get text() { | |
var i=0, children = this.childNodes, l = children.length, ret = []; | |
for (i; i<l; i++) { | |
ret.push(children.item(i).nodeValue); | |
} | |
return ret.join(""); | |
}, | |
set text(text) { | |
while (this.childNodes.length) { | |
this.removeChild(this.childNodes[0]); | |
} | |
this.appendChild(this._ownerDocument.createTextNode(text)); | |
} | |
}, | |
attributes : [ | |
{prop: 'defer', 'type': 'boolean'}, | |
'htmlFor', | |
'event', | |
'charset', | |
'type', | |
'src' | |
] | |
}) | |
define('HTMLTableElement', { | |
tagName: 'TABLE', | |
proto: { | |
get caption() { | |
return firstChild(this, 'CAPTION'); | |
}, | |
get tHead() { | |
return firstChild(this, 'THEAD'); | |
}, | |
get tFoot() { | |
return firstChild(this, 'TFOOT'); | |
}, | |
get rows() { | |
if (!this._rows) { | |
var table = this; | |
this._rows = new core.HTMLCollection(this._ownerDocument, function() { | |
var sections = [table.tHead].concat(table.tBodies._toArray(), table.tFoot).filter(function(s) { return !!s }); | |
if (sections.length === 0) { | |
return core.mapDOMNodes(table, false, function(el) { | |
return el.tagName === 'TR'; | |
}); | |
} | |
return sections.reduce(function(prev, s) { | |
return prev.concat(s.rows._toArray()); | |
}, []); | |
}); | |
} | |
return this._rows; | |
}, | |
get tBodies() { | |
if (!this._tBodies) { | |
this._tBodies = descendants(this, 'TBODY', false); | |
} | |
return this._tBodies; | |
}, | |
createTHead: function() { | |
var el = this.tHead; | |
if (!el) { | |
el = this._ownerDocument.createElement('THEAD'); | |
this.appendChild(el); | |
} | |
return el; | |
}, | |
deleteTHead: function() { | |
var el = this.tHead; | |
if (el) { | |
el._parentNode.removeChild(el); | |
} | |
}, | |
createTFoot: function() { | |
var el = this.tFoot; | |
if (!el) { | |
el = this._ownerDocument.createElement('TFOOT'); | |
this.appendChild(el); | |
} | |
return el; | |
}, | |
deleteTFoot: function() { | |
var el = this.tFoot; | |
if (el) { | |
el._parentNode.removeChild(el); | |
} | |
}, | |
createCaption: function() { | |
var el = this.caption; | |
if (!el) { | |
el = this._ownerDocument.createElement('CAPTION'); | |
this.appendChild(el); | |
} | |
return el; | |
}, | |
deleteCaption: function() { | |
var c = this.caption; | |
if (c) { | |
c._parentNode.removeChild(c); | |
} | |
}, | |
insertRow: function(index) { | |
var tr = this._ownerDocument.createElement('TR'); | |
if (this.childNodes.length === 0) { | |
this.appendChild(this._ownerDocument.createElement('TBODY')); | |
} | |
var rows = this.rows._toArray(); | |
if (index < -1 || index > rows.length) { | |
throw new core.DOMException(core.INDEX_SIZE_ERR); | |
} | |
if (index === -1 || (index === 0 && rows.length === 0)) { | |
this.tBodies.item(0).appendChild(tr); | |
} | |
else if (index === rows.length) { | |
var ref = rows[index-1]; | |
ref._parentNode.appendChild(tr); | |
} | |
else { | |
var ref = rows[index]; | |
ref._parentNode.insertBefore(tr, ref); | |
} | |
return tr; | |
}, | |
deleteRow: function(index) { | |
var rows = this.rows._toArray(), l = rows.length; | |
if (index === -1) { | |
index = l-1; | |
} | |
if (index < 0 || index >= l) { | |
throw new core.DOMException(core.INDEX_SIZE_ERR); | |
} | |
var tr = rows[index]; | |
tr._parentNode.removeChild(tr); | |
} | |
}, | |
attributes: [ | |
'align', | |
'bgColor', | |
'border', | |
'cellPadding', | |
'cellSpacing', | |
'frame', | |
'rules', | |
'summary', | |
'width' | |
] | |
}); | |
define('HTMLTableCaptionElement', { | |
tagName: 'CAPTION', | |
attributes: [ | |
'align' | |
] | |
}); | |
define('HTMLTableColElement', { | |
tagNames: ['COL','COLGROUP'], | |
attributes: [ | |
'align', | |
{prop: 'ch', attr: 'char'}, | |
{prop: 'chOff', attr: 'charoff'}, | |
{prop: 'span', type: 'long'}, | |
'vAlign', | |
'width', | |
] | |
}); | |
define('HTMLTableSectionElement', { | |
tagNames: ['THEAD','TBODY','TFOOT'], | |
proto: { | |
get rows() { | |
if (!this._rows) { | |
this._rows = descendants(this, 'TR', false); | |
} | |
return this._rows; | |
}, | |
insertRow: function(index) { | |
var tr = this._ownerDocument.createElement('TR'); | |
var rows = this.rows._toArray(); | |
if (index < -1 || index > rows.length) { | |
throw new core.DOMException(core.INDEX_SIZE_ERR); | |
} | |
if (index === -1 || index === rows.length) { | |
this.appendChild(tr); | |
} | |
else { | |
var ref = rows[index]; | |
this.insertBefore(tr, ref); | |
} | |
return tr; | |
}, | |
deleteRow: function(index) { | |
var rows = this.rows._toArray(); | |
if (index === -1) { | |
index = rows.length-1; | |
} | |
if (index < 0 || index >= rows.length) { | |
throw new core.DOMException(core.INDEX_SIZE_ERR); | |
} | |
var tr = this.rows[index]; | |
this.removeChild(tr); | |
} | |
}, | |
attributes: [ | |
'align', | |
{prop: 'ch', attr: 'char'}, | |
{prop: 'chOff', attr: 'charoff'}, | |
{prop: 'span', type: 'long'}, | |
'vAlign', | |
'width', | |
] | |
}); | |
define('HTMLTableRowElement', { | |
tagName: 'TR', | |
proto: { | |
get cells() { | |
if (!this._cells) { | |
this._cells = new core.HTMLCollection(this, core.mapper(this, function(n) { | |
return n.nodeName === 'TD' || n.nodeName === 'TH'; | |
}, false)); | |
} | |
return this._cells; | |
}, | |
get rowIndex() { | |
var table = closest(this, 'TABLE'); | |
return table ? table.rows._toArray().indexOf(this) : -1; | |
}, | |
get sectionRowIndex() { | |
return this._parentNode.rows._toArray().indexOf(this); | |
}, | |
insertCell: function(index) { | |
var td = this._ownerDocument.createElement('TD'); | |
var cells = this.cells._toArray(); | |
if (index < -1 || index > cells.length) { | |
throw new core.DOMException(core.INDEX_SIZE_ERR); | |
} | |
if (index === -1 || index === cells.length) { | |
this.appendChild(td); | |
} | |
else { | |
var ref = cells[index]; | |
this.insertBefore(td, ref); | |
} | |
return td; | |
}, | |
deleteCell: function(index) { | |
var cells = this.cells._toArray(); | |
if (index === -1) { | |
index = cells.length-1; | |
} | |
if (index < 0 || index >= cells.length) { | |
throw new core.DOMException(core.INDEX_SIZE_ERR); | |
} | |
var td = this.cells[index]; | |
this.removeChild(td); | |
} | |
}, | |
attributes: [ | |
'align', | |
'bgColor', | |
{prop: 'ch', attr: 'char'}, | |
{prop: 'chOff', attr: 'charoff'}, | |
'vAlign' | |
] | |
}); | |
define('HTMLTableCellElement', { | |
tagNames: ['TH','TD'], | |
proto: { | |
_headers: null, | |
set headers(h) { | |
if (h === '') { | |
//Handle resetting headers so the dynamic getter returns a query | |
this._headers = null; | |
return; | |
} | |
if (!(h instanceof Array)) { | |
h = [h]; | |
} | |
this._headers = h; | |
}, | |
get headers() { | |
if (this._headers) { | |
return this._headers.join(' '); | |
} | |
var cellIndex = this.cellIndex, | |
headings = [], | |
siblings = this._parentNode.getElementsByTagName(this.tagName); | |
for (var i=0; i<siblings.length; i++) { | |
if (siblings.item(i).cellIndex >= cellIndex) { | |
break; | |
} | |
headings.push(siblings.item(i).id); | |
} | |
this._headers = headings; | |
return headings.join(' '); | |
}, | |
get cellIndex() { | |
return closest(this, 'TR').cells._toArray().indexOf(this); | |
} | |
}, | |
attributes: [ | |
'abbr', | |
'align', | |
'axis', | |
'bgColor', | |
{prop: 'ch', attr: 'char'}, | |
{prop: 'chOff', attr: 'charoff'}, | |
{prop: 'colSpan', type: 'long'}, | |
'height', | |
{prop: 'noWrap', type: 'boolean'}, | |
{prop: 'rowSpan', type: 'long'}, | |
'scope', | |
'vAlign', | |
'width' | |
] | |
}); | |
define('HTMLFrameSetElement', { | |
tagName: 'FRAMESET', | |
attributes: [ | |
'cols', | |
'rows' | |
] | |
}); | |
function loadFrame (frame) { | |
if (frame._contentDocument) { | |
// We don't want to access document.parentWindow, since the getter will | |
// cause a new window to be allocated if it doesn't exist. Probe the | |
// private variable instead. | |
if (frame._contentDocument._parentWindow) { | |
// close calls delete on its document. | |
frame._contentDocument.parentWindow.close(); | |
} else { | |
delete frame._contentDocument; | |
} | |
} | |
var src = frame.src.trim() === '' ? 'about:blank' : frame.src; | |
var parentDoc = frame._ownerDocument; | |
// If the URL can't be resolved or the src attribute is missing / blank, | |
// then url should be set to the string "about:blank". | |
// (http://www.whatwg.org/specs/web-apps/current-work/#the-iframe-element) | |
var url = core.resourceLoader.resolve(parentDoc, src); | |
var contentDoc = frame._contentDocument = new core.HTMLDocument({ | |
url: url, | |
documentRoot: Path.dirname(url) | |
}); | |
applyDocumentFeatures(contentDoc, parentDoc.implementation._features); | |
var parent = parentDoc.parentWindow; | |
var contentWindow = contentDoc.parentWindow; | |
contentWindow.parent = parent; | |
contentWindow.top = parent.top; | |
// Handle about:blank with a simulated load of an empty document. | |
if(url === 'about:blank') { | |
core.resourceLoader.enqueue(frame, function() { | |
contentDoc.write(); | |
contentDoc.close(); | |
})(); | |
} else { | |
core.resourceLoader.load(frame, url, function(html, filename) { | |
contentDoc.write(html); | |
contentDoc.close(); | |
}); | |
} | |
} | |
define('HTMLFrameElement', { | |
tagName: 'FRAME', | |
init : function () { | |
// Set up the frames array. window.frames really just returns a reference | |
// to the window object, so the frames array is just implemented as indexes | |
// on the window. | |
var parent = this._ownerDocument.parentWindow; | |
var frameID = parent._length++; | |
var self = this; | |
defineGetter(parent, frameID, function () { | |
return self.contentWindow; | |
}); | |
// The contentDocument/contentWindow shouldn't be created until the frame | |
// is inserted: | |
// "When an iframe element is first inserted into a document, the user | |
// agent must create a nested browsing context, and then process the | |
// iframe attributes for the first time." | |
// (http://www.whatwg.org/specs/web-apps/current-work/#the-iframe-element) | |
this._initInsertListener = function () { | |
loadFrame(self); | |
}; | |
this.addEventListener('DOMNodeInsertedIntoDocument', this._initInsertListener, false); | |
}, | |
proto: { | |
_attrModified: function(name, value, oldVal) { | |
core.HTMLElement.prototype._attrModified.call(this, name, value, oldVal); | |
var self = this; | |
if (name === 'name') { | |
// Remove named frame access. | |
if (oldVal) { | |
this._ownerDocument.parentWindow._frame(oldVal); | |
} | |
// Set up named frame access. | |
if (value) { | |
this._ownerDocument.parentWindow._frame(value, this); | |
} | |
} else if (name === 'src') { | |
// Page we don't fetch the page until the node is inserted. This at | |
// least seems to be the way Chrome does it. | |
if (!this._attachedToDocument) { | |
if (!this._waitingOnInsert) { | |
// First, remove the listener added in 'init'. | |
this.removeEventListener('DOMNodeInsertedIntoDocument', | |
this._initInsertListener, false) | |
// If we aren't already waiting on an insert, add a listener. | |
// This guards against src being set multiple times before the frame | |
// is inserted into the document - we don't want to register multiple | |
// callbacks. | |
this.addEventListener('DOMNodeInsertedIntoDocument', function loader () { | |
self.removeEventListener('DOMNodeInsertedIntoDocument', loader, false); | |
this._waitingOnInsert = false; | |
loadFrame(self); | |
}, false); | |
this._waitingOnInsert = true; | |
} | |
} else { | |
loadFrame(self); | |
} | |
} | |
}, | |
_contentDocument : null, | |
get contentDocument() { | |
if (this._contentDocument == null) { | |
this._contentDocument = new core.HTMLDocument(); | |
} | |
return this._contentDocument; | |
}, | |
get contentWindow() { | |
return this.contentDocument.parentWindow; | |
} | |
}, | |
attributes: [ | |
'frameBorder', | |
'longDesc', | |
'marginHeight', | |
'marginWidth', | |
'name', | |
{prop: 'noResize', type: 'boolean'}, | |
'scrolling', | |
{prop: 'src', type: 'string', write: false} | |
] | |
}); | |
define('HTMLIFrameElement', { | |
tagName: 'IFRAME', | |
parentClass: core.HTMLFrameElement, | |
attributes: [ | |
'align', | |
'frameBorder', | |
'height', | |
'longDesc', | |
'marginHeight', | |
'marginWidth', | |
'name', | |
'scrolling', | |
'src', | |
'width' | |
] | |
}); | |
exports.define = define; | |
exports.dom = { | |
level2 : { | |
html : core | |
} | |
} | |
/***/ }, | |
/* 6 */ | |
/*!*******************************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/browser/documentfeatures.js ***! | |
\*******************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
exports.availableDocumentFeatures = [ | |
'FetchExternalResources', | |
'ProcessExternalResources', | |
'MutationEvents', | |
'SkipExternalResources' | |
]; | |
exports.defaultDocumentFeatures = { | |
"FetchExternalResources": ['script', 'link'/*, 'img', 'css', 'frame'*/], | |
"ProcessExternalResources": ['script'/*, 'frame', 'iframe'*/], | |
"MutationEvents": '2.0', | |
"SkipExternalResources": false | |
}; | |
exports.applyDocumentFeatures = function(doc, features) { | |
var i, maxFeatures = exports.availableDocumentFeatures.length, | |
defaultFeatures = exports.defaultDocumentFeatures, | |
j, | |
k, | |
featureName, | |
featureSource; | |
features = features || {}; | |
for (i=0; i<maxFeatures; i++) { | |
featureName = exports.availableDocumentFeatures[i]; | |
if (typeof features[featureName] !== 'undefined') { | |
featureSource = features[featureName]; | |
// We have to check the lowercase version also because the Document feature | |
// methods convert everything to lowercase. | |
} else if (typeof features[featureName.toLowerCase()] !== 'undefined') { | |
featureSource = features[featureName.toLowerCase()]; | |
} else if (defaultFeatures[featureName]) { | |
featureSource = defaultFeatures[featureName]; | |
} else { | |
continue; | |
} | |
doc.implementation.removeFeature(featureName); | |
if (typeof featureSource !== 'undefined') { | |
if (featureSource instanceof Array) { | |
k = featureSource.length; | |
for (j=0; j<k; j++) { | |
doc.implementation.addFeature(featureName, featureSource[j]); | |
} | |
} else { | |
doc.implementation.addFeature(featureName, featureSource); | |
} | |
} | |
} | |
}; | |
/***/ }, | |
/* 7 */ | |
/*!********************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/browser/index.js ***! | |
\********************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(process, __filename, global) {var http = __webpack_require__(/*! http */ 28), | |
URL = __webpack_require__(/*! url */ 11), | |
HtmlToDom = __webpack_require__(/*! ./htmltodom */ 19).HtmlToDom, | |
domToHtml = __webpack_require__(/*! ./domtohtml */ 8).domToHtml, | |
jsdom = __webpack_require__(/*! ../../jsdom */ 1), | |
Location = __webpack_require__(/*! ./location */ 20), | |
History = __webpack_require__(/*! ./history */ 18), | |
NOT_IMPLEMENTED = __webpack_require__(/*! ./utils */ 21).NOT_IMPLEMENTED, | |
CSSStyleDeclaration = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"cssstyle\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())).CSSStyleDeclaration, | |
toFileUrl = __webpack_require__(/*! ../utils */ 3).toFileUrl, | |
defineGetter = __webpack_require__(/*! ../utils */ 3).defineGetter, | |
defineSetter = __webpack_require__(/*! ../utils */ 3).defineSetter, | |
createFrom = __webpack_require__(/*! ../utils */ 3).createFrom, | |
Contextify = __webpack_require__(/*! contextify */ 16); | |
function matchesDontThrow(el, selector) { | |
try { | |
return el.matchesSelector(selector); | |
} catch (e) { | |
return false; | |
} | |
} | |
/** | |
* Creates a window having a document. The document can be passed as option, | |
* if omitted, a new document will be created. | |
*/ | |
exports.windowAugmentation = function(dom, options) { | |
options = options || {}; | |
var window = exports.createWindow(dom, options); | |
if (!options.document) { | |
var browser = browserAugmentation(dom, options); | |
options.document = (browser.HTMLDocument) ? | |
new browser.HTMLDocument(options) : | |
new browser.Document(options); | |
options.document.write('<html><head></head><body></body></html>'); | |
} | |
var doc = window.document = options.document; | |
if (doc.addEventListener) { | |
if (doc.readyState == 'complete') { | |
var ev = doc.createEvent('HTMLEvents'); | |
ev.initEvent('load', false, false); | |
process.nextTick(function () { | |
window.dispatchEvent(ev); | |
}); | |
} | |
else { | |
doc.addEventListener('load', function(ev) { | |
window.dispatchEvent(ev); | |
}); | |
} | |
} | |
return window; | |
}; | |
/** | |
* Creates a document-less window. | |
*/ | |
exports.createWindow = function(dom, options) { | |
var timers = []; | |
var cssSelectorSplitRE = /((?:[^,"']|"[^"]*"|'[^']*')+)/; | |
function startTimer(startFn, stopFn, callback, ms) { | |
var res = startFn(callback, ms); | |
timers.push( [ res, stopFn ] ); | |
return res; | |
} | |
function stopTimer(id) { | |
if (typeof id === 'undefined') { | |
return; | |
} | |
for (var i in timers) { | |
if (timers[i][0] === id) { | |
timers[i][1].call(this, id); | |
timers.splice(i, 1); | |
break; | |
} | |
} | |
} | |
function stopAllTimers() { | |
timers.forEach(function (t) { | |
t[1].call(this, t[0]); | |
}); | |
timers = []; | |
} | |
function DOMWindow(options) { | |
var url = (options || {}).url || toFileUrl(__filename); | |
this.location = new Location(url, this); | |
this.history = new History(this); | |
this.console._window = this; | |
if (options && options.document) { | |
options.document.location = this.location; | |
} | |
this.addEventListener = function() { | |
dom.Node.prototype.addEventListener.apply(window, arguments); | |
}; | |
this.removeEventListener = function() { | |
dom.Node.prototype.removeEventListener.apply(window, arguments); | |
}; | |
this.dispatchEvent = function() { | |
dom.Node.prototype.dispatchEvent.apply(window, arguments); | |
}; | |
this.raise = function(){ | |
dom.Node.prototype.raise.apply(window.document, arguments); | |
}; | |
this.setTimeout = function (fn, ms) { return startTimer(setTimeout, clearTimeout, fn, ms); }; | |
this.setInterval = function (fn, ms) { return startTimer(setInterval, clearInterval, fn, ms); }; | |
this.clearInterval = stopTimer; | |
this.clearTimeout = stopTimer; | |
this.__stopAllTimers = stopAllTimers; | |
} | |
DOMWindow.prototype = createFrom(dom || null, { | |
constructor: DOMWindow, | |
// This implements window.frames.length, since window.frames returns a | |
// self reference to the window object. This value is incremented in the | |
// HTMLFrameElement init function (see: level2/html.js). | |
_length : 0, | |
get length () { | |
return this._length; | |
}, | |
close : function() { | |
// Recursively close child frame windows, then ourselves. | |
var currentWindow = this; | |
(function windowCleaner (window) { | |
var i; | |
// We could call window.frames.length etc, but window.frames just points | |
// back to window. | |
if (window.length > 0) { | |
for (i = 0; i < window.length; i++) { | |
windowCleaner(window[i]); | |
} | |
} | |
// We're already in our own window.close(). | |
if (window !== currentWindow) { | |
window.close(); | |
} | |
})(this); | |
if (this.document) { | |
if (this.document.body) { | |
this.document.body.innerHTML = ""; | |
} | |
if (this.document.close) { | |
// We need to empty out the event listener array because | |
// document.close() causes 'load' event to re-fire. | |
this.document._listeners = []; | |
this.document.close(); | |
} | |
delete this.document; | |
} | |
stopAllTimers(); | |
// Clean up the window's execution context. | |
// dispose() is added by Contextify. | |
setTimeout(this.dispose.bind(this), 0); | |
}, | |
getComputedStyle: function(node) { | |
var s = node.style, | |
cs = new CSSStyleDeclaration(), | |
forEach = Array.prototype.forEach; | |
function setPropertiesFromRule(rule) { | |
if (!rule.selectorText) { | |
return; | |
} | |
var selectors = rule.selectorText.split(cssSelectorSplitRE); | |
var matched = false; | |
selectors.forEach(function (selectorText) { | |
if (selectorText !== '' && selectorText !== ',' && !matched && matchesDontThrow(node, selectorText)) { | |
matched = true; | |
forEach.call(rule.style, function (property) { | |
cs.setProperty(property, rule.style.getPropertyValue(property), rule.style.getPropertyPriority(property)); | |
}); | |
} | |
}); | |
} | |
forEach.call(node.ownerDocument.styleSheets, function (sheet) { | |
forEach.call(sheet.cssRules, function (rule) { | |
if (rule.media) { | |
if (Array.prototype.indexOf.call(rule.media, 'screen') !== -1) { | |
forEach.call(rule.cssRules, setPropertiesFromRule); | |
} | |
} else { | |
setPropertiesFromRule(rule); | |
} | |
}); | |
}); | |
forEach.call(s, function (property) { | |
cs.setProperty(property, s.getPropertyValue(property), s.getPropertyPriority(property)); | |
}); | |
return cs; | |
}, | |
console: { | |
log: function(message) { this._window.raise('log', message) }, | |
info: function(message) { this._window.raise('info', message) }, | |
warn: function(message) { this._window.raise('warn', message) }, | |
error: function(message) { this._window.raise('error', message) } | |
}, | |
navigator: { | |
get userAgent() { return 'Node.js (' + process.platform + '; U; rv:' + process.version + ')'; }, | |
get appName() { return 'Node.js jsDom'; }, | |
get platform() { return process.platform; }, | |
get appVersion() { return process.version; }, | |
noUI: true, | |
get cookieEnabled() { return true; } | |
}, | |
XMLHttpRequest: function() { | |
var XMLHttpRequest = __webpack_require__(/*! xmlhttprequest */ 41).XMLHttpRequest; | |
var xhr = new XMLHttpRequest(); | |
var lastUrl = ''; | |
xhr._open = xhr.open; | |
xhr.open = function(method, url, async, user, password) { | |
url = URL.resolve(options.url, url); | |
lastUrl = url; | |
return xhr._open(method, url, async, user, password); | |
}; | |
xhr._send = xhr.send; | |
xhr.send = function(data) { | |
if (window.document.cookie) { | |
var cookieDomain = window.document._cookieDomain; | |
var url = URL.parse(lastUrl); | |
var host = url.host.split(':')[0]; | |
if (host.indexOf(cookieDomain, host.length - cookieDomain.length) !== -1) { | |
xhr.setDisableHeaderCheck(true); | |
xhr.setRequestHeader('cookie', window.document.cookie); | |
xhr.setDisableHeaderCheck(false); | |
} | |
} | |
return xhr._send(data); | |
}; | |
return xhr; | |
}, | |
name: 'nodejs', | |
innerWidth: 1024, | |
innerHeight: 768, | |
outerWidth: 1024, | |
outerHeight: 768, | |
pageXOffset: 0, | |
pageYOffset: 0, | |
screenX: 0, | |
screenY: 0, | |
screenLeft: 0, | |
screenTop: 0, | |
scrollX: 0, | |
scrollY: 0, | |
scrollTop: 0, | |
scrollLeft: 0, | |
alert: NOT_IMPLEMENTED(null, 'window.alert'), | |
blur: NOT_IMPLEMENTED(null, 'window.blur'), | |
confirm: NOT_IMPLEMENTED(null, 'window.confirm'), | |
createPopup: NOT_IMPLEMENTED(null, 'window.createPopup'), | |
focus: NOT_IMPLEMENTED(null, 'window.focus'), | |
moveBy: NOT_IMPLEMENTED(null, 'window.moveBy'), | |
moveTo: NOT_IMPLEMENTED(null, 'window.moveTo'), | |
open: NOT_IMPLEMENTED(null, 'window.open'), | |
print: NOT_IMPLEMENTED(null, 'window.print'), | |
prompt: NOT_IMPLEMENTED(null, 'window.prompt'), | |
resizeBy: NOT_IMPLEMENTED(null, 'window.resizeBy'), | |
resizeTo: NOT_IMPLEMENTED(null, 'window.resizeTo'), | |
scroll: NOT_IMPLEMENTED(null, 'window.scroll'), | |
scrollBy: NOT_IMPLEMENTED(null, 'window.scrollBy'), | |
scrollTo: NOT_IMPLEMENTED(null, 'window.scrollTo'), | |
screen : { | |
width : 0, | |
height : 0 | |
}, | |
Image : NOT_IMPLEMENTED(null, 'window.Image'), | |
// Note: these will not be necessary for newer Node.js versions, which have | |
// typed arrays in V8 and thus on every global object. (That is, in newer | |
// versions we'll get `ArrayBuffer` just as automatically as we get | |
// `Array`.) But to support older versions, we explicitly set them here. | |
Int8Array: global.Int8Array, | |
Int16Array: global.Int16Array, | |
Int32Array: global.Int32Array, | |
Float32Array: global.Float32Array, | |
Float64Array: global.Float64Array, | |
Uint8Array: global.Uint8Array, | |
Uint8ClampedArray: global.Uint8ClampedArray, | |
Uint16Array: global.Uint16Array, | |
Uint32Array: global.Uint32Array, | |
ArrayBuffer: global.ArrayBuffer | |
}); | |
var window = new DOMWindow(options); | |
Contextify(window); | |
// We need to set up self references using Contextify's getGlobal() so that | |
// the global object identity is correct (window === this). | |
// See Contextify README for more info. | |
var windowGlobal = window.getGlobal(); | |
// Set up the window as if it's a top level window. | |
// If it's not, then references will be corrected by frame/iframe code. | |
// Note: window.frames is maintained in the HTMLFrameElement init function. | |
window.window = window.frames | |
= window.self | |
= window.parent | |
= window.top = windowGlobal; | |
return window; | |
}; | |
/** | |
* Augments the given DOM by adding browser-specific properties and methods (BOM). | |
* Returns the augmented DOM. | |
*/ | |
var browserAugmentation = exports.browserAugmentation = function(dom, options) { | |
if(!options) { | |
options = {}; | |
} | |
// set up html parser - use a provided one or try and load from library | |
var parser = options.parser; | |
if (dom._augmented && dom._parser === parser && dom._parsingMode === options.parsingMode) { | |
return dom; | |
} | |
dom._parser = parser; | |
dom._parsingMode = options.parsingMode; | |
var htmltodom = new HtmlToDom(parser, options.parsingMode); | |
function setInnerHTML(node, html) { | |
//Clear the children first: | |
var child; | |
while ((child = node._childNodes[0])) { | |
node.removeChild(child); | |
} | |
var isDoc = node.nodeName === '#document'; | |
if (isDoc) { | |
parseDocType(node, html); | |
if (node._doctype) { | |
node._childNodes[0] = node._doctype; | |
} | |
} | |
if (html !== "" && html != null) { | |
if (isDoc) { | |
htmltodom.appendHtmlToDocument(html, node); | |
} else { | |
htmltodom.appendHtmlToElement(html, node); | |
} | |
} | |
} | |
if (!dom.HTMLDocument) { | |
dom.HTMLDocument = dom.Document; | |
} | |
dom.HTMLDocument.prototype.write = function(text) { | |
if (this._writeAfterElement) { | |
// If called from an script element directly (during the first tick), | |
// the new elements are inserted right after that element. | |
var tempDiv = this.createElement('div'); | |
setInnerHTML(tempDiv, text); | |
var child = tempDiv.firstChild; | |
var previous = this._writeAfterElement; | |
var parent = this._writeAfterElement.parentNode; | |
while (child) { | |
var node = child; | |
child = child.nextSibling; | |
parent.insertBefore(node, previous.nextSibling); | |
previous = node; | |
} | |
} else if (this.readyState === "loading") { | |
// During page loading, document.write appends to the current element | |
// Find the last child that has been added to the document. | |
var node = this; | |
while (node.lastChild && node.lastChild.nodeType === this.ELEMENT_NODE) { | |
node = node.lastChild; | |
} | |
setInnerHTML(node, text || "<html><head></head><body></body></html>"); | |
} else if (text) { | |
setInnerHTML(this, text); | |
} | |
}; | |
dom.Element.prototype.getElementsByClassName = function(className) { | |
function filterByClassName(child) { | |
if (!child) { | |
return false; | |
} | |
if (child.nodeType && | |
child.nodeType === dom.Node.ENTITY_REFERENCE_NODE) | |
{ | |
child = child._entity; | |
} | |
var classString = child.className; | |
if (classString) { | |
var s = classString.split(" "); | |
for (var i=0; i<s.length; i++) { | |
if (s[i] === className) { | |
return true; | |
} | |
} | |
} | |
return false; | |
} | |
return new dom.NodeList(this.ownerDocument || this, dom.mapper(this, filterByClassName)); | |
}; | |
defineGetter(dom.Element.prototype, 'sourceIndex', function() { | |
/* | |
* According to QuirksMode: | |
* Get the sourceIndex of element x. This is also the index number for | |
* the element in the document.getElementsByTagName('*') array. | |
* http://www.quirksmode.org/dom/w3c_core.html#t77 | |
*/ | |
var items = this.ownerDocument.getElementsByTagName('*'), | |
len = items.length; | |
for (var i = 0; i < len; i++) { | |
if (items[i] === this) { | |
return i; | |
} | |
} | |
}); | |
defineGetter(dom.Element.prototype, 'outerHTML', function() { | |
return domToHtml(this, true); | |
}); | |
defineGetter(dom.Element.prototype, 'innerHTML', function() { | |
if (/^(?:script|style)$/.test(this._tagName)) { | |
var type = this.getAttribute('type'); | |
if (!type || /^text\//i.test(type) || /\/javascript$/i.test(type)) { | |
return domToHtml(this._childNodes, true, true); | |
} | |
} | |
return domToHtml(this._childNodes, true); | |
}); | |
defineSetter(dom.Element.prototype, 'doctype', function() { | |
throw new dom.DOMException(dom.NO_MODIFICATION_ALLOWED_ERR); | |
}); | |
defineGetter(dom.Element.prototype, 'doctype', function() { | |
var r = null; | |
if (this.nodeName == '#document') { | |
if (this._doctype) { | |
r = this._doctype; | |
} | |
} | |
return r; | |
}); | |
defineSetter(dom.Element.prototype, 'innerHTML', function(html) { | |
setInnerHTML(this, html); | |
return html; | |
}); | |
var DOC_HTML5 = /<!doctype html>/i, | |
DOC_TYPE = /<!DOCTYPE (\w(.|\n)*)">/i, | |
DOC_TYPE_START = '<!DOCTYPE ', | |
DOC_TYPE_END = '">'; | |
function parseDocType(doc, html) { | |
var publicID = '', | |
systemID = '', | |
fullDT = '', | |
name = 'html', | |
set = true, | |
doctype = html.match(DOC_HTML5); | |
//Default, No doctype === null | |
doc._doctype = null; | |
if (doctype && doctype[0]) { //Handle the HTML shorty doctype | |
fullDT = doctype[0]; | |
} else { //Parse the doctype | |
// find the start | |
var start = html.indexOf(DOC_TYPE_START), | |
end = html.indexOf(DOC_TYPE_END), | |
docString; | |
if (start < 0 || end < 0) { | |
return; | |
} | |
docString = html.substr(start, (end-start)+DOC_TYPE_END.length); | |
doctype = docString.replace(/[\n\r]/g,'').match(DOC_TYPE); | |
if (!doctype) { | |
return; | |
} | |
fullDT = doctype[0]; | |
doctype = doctype[1].split(' "'); | |
var _id1 = doctype.length ? doctype.pop().replace(/"/g, '') : '', | |
_id2 = doctype.length ? doctype.pop().replace(/"/g, '') : ''; | |
if (_id1.indexOf('-//') !== -1) { | |
publicID = _id1; | |
} | |
if (_id2.indexOf('-//') !== -1) { | |
publicID = _id2; | |
} | |
if (_id1.indexOf('://') !== -1) { | |
systemID = _id1; | |
} | |
if (_id2.indexOf('://') !== -1) { | |
systemID = _id2; | |
} | |
if (doctype.length) { | |
doctype = doctype[0].split(' '); | |
name = doctype[0]; | |
} | |
} | |
doc._doctype = new dom.DOMImplementation().createDocumentType(name, publicID, systemID); | |
doc._doctype._ownerDocument = doc; | |
doc._doctype._parentNode = doc; | |
doc._doctype._fullDT = fullDT; | |
doc._doctype.toString = function() { | |
return this._fullDT; | |
}; | |
} | |
dom.Document.prototype.getElementsByClassName = function(className) { | |
function filterByClassName(child) { | |
if (!child) { | |
return false; | |
} | |
if (child.nodeType && | |
child.nodeType === dom.Node.ENTITY_REFERENCE_NODE) | |
{ | |
child = child._entity; | |
} | |
var classString = child.className; | |
if (classString) { | |
var s = classString.split(" "); | |
for (var i=0; i<s.length; i++) { | |
if (s[i] === className) { | |
return true; | |
} | |
} | |
} | |
return false; | |
} | |
return new dom.NodeList(this.ownerDocument || this, dom.mapper(this, filterByClassName)); | |
}; | |
defineGetter(dom.Element.prototype, 'nodeName', function(val) { | |
return this._nodeName.toUpperCase(); | |
}); | |
defineGetter(dom.Element.prototype, 'tagName', function(val) { | |
var t = this._tagName.toUpperCase(); | |
//Document should not return a tagName | |
if (this.nodeName === '#document') { | |
t = null; | |
} | |
return t; | |
}); | |
dom.Element.prototype.scrollTop = 0; | |
dom.Element.prototype.scrollLeft = 0; | |
defineGetter(dom.Document.prototype, 'parentWindow', function() { | |
if (!this._parentWindow) { | |
this.parentWindow = exports.windowAugmentation(dom, {document: this, url: this.URL}); | |
} | |
return this._parentWindow; | |
}); | |
defineSetter(dom.Document.prototype, 'parentWindow', function(window) { | |
// Contextify does not support getters and setters, so we have to set them | |
// on the original object instead. | |
window._frame = function (name, frame) { | |
if (typeof frame === 'undefined') { | |
delete window[name]; | |
} else { | |
defineGetter(window, name, function () { return frame.contentWindow; }); | |
} | |
}; | |
this._parentWindow = window.getGlobal(); | |
}); | |
defineGetter(dom.Document.prototype, 'defaultView', function() { | |
return this.parentWindow; | |
}); | |
dom._augmented = true; | |
return dom; | |
}; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! (webpack)/~/node-libs-browser/~/process/browser.js */ 13), "/index.js", (function() { return this; }()))) | |
/***/ }, | |
/* 8 */ | |
/*!************************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/browser/domtohtml.js ***! | |
\************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
"use strict"; | |
var parse5 = __webpack_require__(/*! parse5 */ 39); | |
var serializer = new parse5.TreeSerializer(__webpack_require__(/*! ./documentAdapter */ 17)); | |
exports.domToHtml = function(dom) { | |
if (dom._toArray) { | |
// node list | |
dom = dom._toArray(); | |
} | |
if (typeof dom.length !== "undefined") { | |
var ret = ""; | |
for (var i = 0, len = dom.length; i < len; i++) { | |
ret += dom[i]._tagName === "#document" ? | |
serializer.serialize(dom[i]) : | |
serializer.serialize({ childNodes: [dom[i]] }); | |
} | |
return ret; | |
} else { | |
return dom._tagName === "#document" ? | |
serializer.serialize(dom) : | |
serializer.serialize({ childNodes: [dom] }); | |
} | |
}; | |
/***/ }, | |
/* 9 */ | |
/*!*******************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/living/index.js ***! | |
\*******************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var core = __webpack_require__(/*! ./core */ 25).dom.living.core; | |
var html = __webpack_require__(/*! ../level2/html */ 5).dom.level2.html; | |
exports.dom = { living: { core: core, html: html } }; | |
/***/ }, | |
/* 10 */ | |
/*!**********************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/selectors/index.js ***! | |
\**********************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var nwmatcher = __webpack_require__(/*! nwmatcher/src/nwmatcher-noqsa */ 42); | |
var core = __webpack_require__(/*! ../level2/core */ 22).dom.level2.core; | |
function addNwmatcher(document) { | |
if (!document._nwmatcher) { | |
document._nwmatcher = nwmatcher({ document: document }); | |
document._nwmatcher.configure({ UNIQUE_ID: false }); | |
} | |
return document._nwmatcher; | |
} | |
exports.applyQuerySelectorPrototype = function(dom) { | |
dom.Document.prototype.querySelector = core.memoizeQuery(function(selector) { | |
return addNwmatcher(this).first(selector, this); | |
}); | |
dom.Document.prototype.querySelectorAll = core.memoizeQuery(function(selector) { | |
return new dom.NodeList(addNwmatcher(this).select(selector, this)); | |
}); | |
dom.DocumentFragment.prototype.querySelector = core.memoizeQuery(function(selector) { | |
return addNwmatcher(this.ownerDocument).first(selector, this); | |
}); | |
dom.DocumentFragment.prototype.querySelectorAll = core.memoizeQuery(function(selector) { | |
return new dom.NodeList(addNwmatcher(this.ownerDocument).select(selector, this)); | |
}); | |
dom.Element.prototype.querySelector = core.memoizeQuery(function(selector) { | |
return addNwmatcher(this.ownerDocument).first(selector, this); | |
}); | |
dom.Element.prototype.querySelectorAll = core.memoizeQuery(function(selector) { | |
return new dom.NodeList(addNwmatcher(this.ownerDocument).select(selector, this)); | |
}); | |
dom.Element.prototype.matchesSelector = core.memoizeQuery(function(selector) { | |
return addNwmatcher(this.ownerDocument).match(this, selector); | |
}); | |
}; | |
/***/ }, | |
/* 11 */ | |
/*!**************************************************!*\ | |
!*** (webpack)/~/node-libs-browser/~/url/url.js ***! | |
\**************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
// Copyright Joyent, Inc. and other Node contributors. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a | |
// copy of this software and associated documentation files (the | |
// "Software"), to deal in the Software without restriction, including | |
// without limitation the rights to use, copy, modify, merge, publish, | |
// distribute, sublicense, and/or sell copies of the Software, and to permit | |
// persons to whom the Software is furnished to do so, subject to the | |
// following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included | |
// in all copies or substantial portions of the Software. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | |
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | |
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | |
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | |
// USE OR OTHER DEALINGS IN THE SOFTWARE. | |
var punycode = __webpack_require__(/*! punycode */ 44); | |
exports.parse = urlParse; | |
exports.resolve = urlResolve; | |
exports.resolveObject = urlResolveObject; | |
exports.format = urlFormat; | |
exports.Url = Url; | |
function Url() { | |
this.protocol = null; | |
this.slashes = null; | |
this.auth = null; | |
this.host = null; | |
this.port = null; | |
this.hostname = null; | |
this.hash = null; | |
this.search = null; | |
this.query = null; | |
this.pathname = null; | |
this.path = null; | |
this.href = null; | |
} | |
// Reference: RFC 3986, RFC 1808, RFC 2396 | |
// define these here so at least they only have to be | |
// compiled once on the first module load. | |
var protocolPattern = /^([a-z0-9.+-]+:)/i, | |
portPattern = /:[0-9]*$/, | |
// RFC 2396: characters reserved for delimiting URLs. | |
// We actually just auto-escape these. | |
delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], | |
// RFC 2396: characters not allowed for various reasons. | |
unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), | |
// Allowed by RFCs, but cause of XSS attacks. Always escape these. | |
autoEscape = ['\''].concat(unwise), | |
// Characters that are never ever allowed in a hostname. | |
// Note that any invalid chars are also handled, but these | |
// are the ones that are *expected* to be seen, so we fast-path | |
// them. | |
nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), | |
hostEndingChars = ['/', '?', '#'], | |
hostnameMaxLen = 255, | |
hostnamePartPattern = /^[a-z0-9A-Z_-]{0,63}$/, | |
hostnamePartStart = /^([a-z0-9A-Z_-]{0,63})(.*)$/, | |
// protocols that can allow "unsafe" and "unwise" chars. | |
unsafeProtocol = { | |
'javascript': true, | |
'javascript:': true | |
}, | |
// protocols that never have a hostname. | |
hostlessProtocol = { | |
'javascript': true, | |
'javascript:': true | |
}, | |
// protocols that always contain a // bit. | |
slashedProtocol = { | |
'http': true, | |
'https': true, | |
'ftp': true, | |
'gopher': true, | |
'file': true, | |
'http:': true, | |
'https:': true, | |
'ftp:': true, | |
'gopher:': true, | |
'file:': true | |
}, | |
querystring = __webpack_require__(/*! querystring */ 43); | |
function urlParse(url, parseQueryString, slashesDenoteHost) { | |
if (url && isObject(url) && url instanceof Url) return url; | |
var u = new Url; | |
u.parse(url, parseQueryString, slashesDenoteHost); | |
return u; | |
} | |
Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { | |
if (!isString(url)) { | |
throw new TypeError("Parameter 'url' must be a string, not " + typeof url); | |
} | |
var rest = url; | |
// trim before proceeding. | |
// This is to support parse stuff like " http://foo.com \n" | |
rest = rest.trim(); | |
var proto = protocolPattern.exec(rest); | |
if (proto) { | |
proto = proto[0]; | |
var lowerProto = proto.toLowerCase(); | |
this.protocol = lowerProto; | |
rest = rest.substr(proto.length); | |
} | |
// figure out if it's got a host | |
// user@server is *always* interpreted as a hostname, and url | |
// resolution will treat //foo/bar as host=foo,path=bar because that's | |
// how the browser resolves relative URLs. | |
if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { | |
var slashes = rest.substr(0, 2) === '//'; | |
if (slashes && !(proto && hostlessProtocol[proto])) { | |
rest = rest.substr(2); | |
this.slashes = true; | |
} | |
} | |
if (!hostlessProtocol[proto] && | |
(slashes || (proto && !slashedProtocol[proto]))) { | |
// there's a hostname. | |
// the first instance of /, ?, ;, or # ends the host. | |
// | |
// If there is an @ in the hostname, then non-host chars *are* allowed | |
// to the left of the last @ sign, unless some host-ending character | |
// comes *before* the @-sign. | |
// URLs are obnoxious. | |
// | |
// ex: | |
// http://a@b@c/ => user:a@b host:c | |
// http://a@b?@c => user:a host:c path:/?@c | |
// v0.12 TODO(isaacs): This is not quite how Chrome does things. | |
// Review our test case against browsers more comprehensively. | |
// find the first instance of any hostEndingChars | |
var hostEnd = -1; | |
for (var i = 0; i < hostEndingChars.length; i++) { | |
var hec = rest.indexOf(hostEndingChars[i]); | |
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) | |
hostEnd = hec; | |
} | |
// at this point, either we have an explicit point where the | |
// auth portion cannot go past, or the last @ char is the decider. | |
var auth, atSign; | |
if (hostEnd === -1) { | |
// atSign can be anywhere. | |
atSign = rest.lastIndexOf('@'); | |
} else { | |
// atSign must be in auth portion. | |
// http://a@b/c@d => host:b auth:a path:/c@d | |
atSign = rest.lastIndexOf('@', hostEnd); | |
} | |
// Now we have a portion which is definitely the auth. | |
// Pull that off. | |
if (atSign !== -1) { | |
auth = rest.slice(0, atSign); | |
rest = rest.slice(atSign + 1); | |
this.auth = decodeURIComponent(auth); | |
} | |
// the host is the remaining to the left of the first non-host char | |
hostEnd = -1; | |
for (var i = 0; i < nonHostChars.length; i++) { | |
var hec = rest.indexOf(nonHostChars[i]); | |
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) | |
hostEnd = hec; | |
} | |
// if we still have not hit it, then the entire thing is a host. | |
if (hostEnd === -1) | |
hostEnd = rest.length; | |
this.host = rest.slice(0, hostEnd); | |
rest = rest.slice(hostEnd); | |
// pull out port. | |
this.parseHost(); | |
// we've indicated that there is a hostname, | |
// so even if it's empty, it has to be present. | |
this.hostname = this.hostname || ''; | |
// if hostname begins with [ and ends with ] | |
// assume that it's an IPv6 address. | |
var ipv6Hostname = this.hostname[0] === '[' && | |
this.hostname[this.hostname.length - 1] === ']'; | |
// validate a little. | |
if (!ipv6Hostname) { | |
var hostparts = this.hostname.split(/\./); | |
for (var i = 0, l = hostparts.length; i < l; i++) { | |
var part = hostparts[i]; | |
if (!part) continue; | |
if (!part.match(hostnamePartPattern)) { | |
var newpart = ''; | |
for (var j = 0, k = part.length; j < k; j++) { | |
if (part.charCodeAt(j) > 127) { | |
// we replace non-ASCII char with a temporary placeholder | |
// we need this to make sure size of hostname is not | |
// broken by replacing non-ASCII by nothing | |
newpart += 'x'; | |
} else { | |
newpart += part[j]; | |
} | |
} | |
// we test again with ASCII char only | |
if (!newpart.match(hostnamePartPattern)) { | |
var validParts = hostparts.slice(0, i); | |
var notHost = hostparts.slice(i + 1); | |
var bit = part.match(hostnamePartStart); | |
if (bit) { | |
validParts.push(bit[1]); | |
notHost.unshift(bit[2]); | |
} | |
if (notHost.length) { | |
rest = '/' + notHost.join('.') + rest; | |
} | |
this.hostname = validParts.join('.'); | |
break; | |
} | |
} | |
} | |
} | |
if (this.hostname.length > hostnameMaxLen) { | |
this.hostname = ''; | |
} else { | |
// hostnames are always lower case. | |
this.hostname = this.hostname.toLowerCase(); | |
} | |
if (!ipv6Hostname) { | |
// IDNA Support: Returns a puny coded representation of "domain". | |
// It only converts the part of the domain name that | |
// has non ASCII characters. I.e. it dosent matter if | |
// you call it with a domain that already is in ASCII. | |
var domainArray = this.hostname.split('.'); | |
var newOut = []; | |
for (var i = 0; i < domainArray.length; ++i) { | |
var s = domainArray[i]; | |
newOut.push(s.match(/[^A-Za-z0-9_-]/) ? | |
'xn--' + punycode.encode(s) : s); | |
} | |
this.hostname = newOut.join('.'); | |
} | |
var p = this.port ? ':' + this.port : ''; | |
var h = this.hostname || ''; | |
this.host = h + p; | |
this.href += this.host; | |
// strip [ and ] from the hostname | |
// the host field still retains them, though | |
if (ipv6Hostname) { | |
this.hostname = this.hostname.substr(1, this.hostname.length - 2); | |
if (rest[0] !== '/') { | |
rest = '/' + rest; | |
} | |
} | |
} | |
// now rest is set to the post-host stuff. | |
// chop off any delim chars. | |
if (!unsafeProtocol[lowerProto]) { | |
// First, make 100% sure that any "autoEscape" chars get | |
// escaped, even if encodeURIComponent doesn't think they | |
// need to be. | |
for (var i = 0, l = autoEscape.length; i < l; i++) { | |
var ae = autoEscape[i]; | |
var esc = encodeURIComponent(ae); | |
if (esc === ae) { | |
esc = escape(ae); | |
} | |
rest = rest.split(ae).join(esc); | |
} | |
} | |
// chop off from the tail first. | |
var hash = rest.indexOf('#'); | |
if (hash !== -1) { | |
// got a fragment string. | |
this.hash = rest.substr(hash); | |
rest = rest.slice(0, hash); | |
} | |
var qm = rest.indexOf('?'); | |
if (qm !== -1) { | |
this.search = rest.substr(qm); | |
this.query = rest.substr(qm + 1); | |
if (parseQueryString) { | |
this.query = querystring.parse(this.query); | |
} | |
rest = rest.slice(0, qm); | |
} else if (parseQueryString) { | |
// no query string, but parseQueryString still requested | |
this.search = ''; | |
this.query = {}; | |
} | |
if (rest) this.pathname = rest; | |
if (slashedProtocol[lowerProto] && | |
this.hostname && !this.pathname) { | |
this.pathname = '/'; | |
} | |
//to support http.request | |
if (this.pathname || this.search) { | |
var p = this.pathname || ''; | |
var s = this.search || ''; | |
this.path = p + s; | |
} | |
// finally, reconstruct the href based on what has been validated. | |
this.href = this.format(); | |
return this; | |
}; | |
// format a parsed object into a url string | |
function urlFormat(obj) { | |
// ensure it's an object, and not a string url. | |
// If it's an obj, this is a no-op. | |
// this way, you can call url_format() on strings | |
// to clean up potentially wonky urls. | |
if (isString(obj)) obj = urlParse(obj); | |
if (!(obj instanceof Url)) return Url.prototype.format.call(obj); | |
return obj.format(); | |
} | |
Url.prototype.format = function() { | |
var auth = this.auth || ''; | |
if (auth) { | |
auth = encodeURIComponent(auth); | |
auth = auth.replace(/%3A/i, ':'); | |
auth += '@'; | |
} | |
var protocol = this.protocol || '', | |
pathname = this.pathname || '', | |
hash = this.hash || '', | |
host = false, | |
query = ''; | |
if (this.host) { | |
host = auth + this.host; | |
} else if (this.hostname) { | |
host = auth + (this.hostname.indexOf(':') === -1 ? | |
this.hostname : | |
'[' + this.hostname + ']'); | |
if (this.port) { | |
host += ':' + this.port; | |
} | |
} | |
if (this.query && | |
isObject(this.query) && | |
Object.keys(this.query).length) { | |
query = querystring.stringify(this.query); | |
} | |
var search = this.search || (query && ('?' + query)) || ''; | |
if (protocol && protocol.substr(-1) !== ':') protocol += ':'; | |
// only the slashedProtocols get the //. Not mailto:, xmpp:, etc. | |
// unless they had them to begin with. | |
if (this.slashes || | |
(!protocol || slashedProtocol[protocol]) && host !== false) { | |
host = '//' + (host || ''); | |
if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; | |
} else if (!host) { | |
host = ''; | |
} | |
if (hash && hash.charAt(0) !== '#') hash = '#' + hash; | |
if (search && search.charAt(0) !== '?') search = '?' + search; | |
pathname = pathname.replace(/[?#]/g, function(match) { | |
return encodeURIComponent(match); | |
}); | |
search = search.replace('#', '%23'); | |
return protocol + host + pathname + search + hash; | |
}; | |
function urlResolve(source, relative) { | |
return urlParse(source, false, true).resolve(relative); | |
} | |
Url.prototype.resolve = function(relative) { | |
return this.resolveObject(urlParse(relative, false, true)).format(); | |
}; | |
function urlResolveObject(source, relative) { | |
if (!source) return relative; | |
return urlParse(source, false, true).resolveObject(relative); | |
} | |
Url.prototype.resolveObject = function(relative) { | |
if (isString(relative)) { | |
var rel = new Url(); | |
rel.parse(relative, false, true); | |
relative = rel; | |
} | |
var result = new Url(); | |
Object.keys(this).forEach(function(k) { | |
result[k] = this[k]; | |
}, this); | |
// hash is always overridden, no matter what. | |
// even href="" will remove it. | |
result.hash = relative.hash; | |
// if the relative url is empty, then there's nothing left to do here. | |
if (relative.href === '') { | |
result.href = result.format(); | |
return result; | |
} | |
// hrefs like //foo/bar always cut to the protocol. | |
if (relative.slashes && !relative.protocol) { | |
// take everything except the protocol from relative | |
Object.keys(relative).forEach(function(k) { | |
if (k !== 'protocol') | |
result[k] = relative[k]; | |
}); | |
//urlParse appends trailing / to urls like http://www.example.com | |
if (slashedProtocol[result.protocol] && | |
result.hostname && !result.pathname) { | |
result.path = result.pathname = '/'; | |
} | |
result.href = result.format(); | |
return result; | |
} | |
if (relative.protocol && relative.protocol !== result.protocol) { | |
// if it's a known url protocol, then changing | |
// the protocol does weird things | |
// first, if it's not file:, then we MUST have a host, | |
// and if there was a path | |
// to begin with, then we MUST have a path. | |
// if it is file:, then the host is dropped, | |
// because that's known to be hostless. | |
// anything else is assumed to be absolute. | |
if (!slashedProtocol[relative.protocol]) { | |
Object.keys(relative).forEach(function(k) { | |
result[k] = relative[k]; | |
}); | |
result.href = result.format(); | |
return result; | |
} | |
result.protocol = relative.protocol; | |
if (!relative.host && !hostlessProtocol[relative.protocol]) { | |
var relPath = (relative.pathname || '').split('/'); | |
while (relPath.length && !(relative.host = relPath.shift())); | |
if (!relative.host) relative.host = ''; | |
if (!relative.hostname) relative.hostname = ''; | |
if (relPath[0] !== '') relPath.unshift(''); | |
if (relPath.length < 2) relPath.unshift(''); | |
result.pathname = relPath.join('/'); | |
} else { | |
result.pathname = relative.pathname; | |
} | |
result.search = relative.search; | |
result.query = relative.query; | |
result.host = relative.host || ''; | |
result.auth = relative.auth; | |
result.hostname = relative.hostname || relative.host; | |
result.port = relative.port; | |
// to support http.request | |
if (result.pathname || result.search) { | |
var p = result.pathname || ''; | |
var s = result.search || ''; | |
result.path = p + s; | |
} | |
result.slashes = result.slashes || relative.slashes; | |
result.href = result.format(); | |
return result; | |
} | |
var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), | |
isRelAbs = ( | |
relative.host || | |
relative.pathname && relative.pathname.charAt(0) === '/' | |
), | |
mustEndAbs = (isRelAbs || isSourceAbs || | |
(result.host && relative.pathname)), | |
removeAllDots = mustEndAbs, | |
srcPath = result.pathname && result.pathname.split('/') || [], | |
relPath = relative.pathname && relative.pathname.split('/') || [], | |
psychotic = result.protocol && !slashedProtocol[result.protocol]; | |
// if the url is a non-slashed url, then relative | |
// links like ../.. should be able | |
// to crawl up to the hostname, as well. This is strange. | |
// result.protocol has already been set by now. | |
// Later on, put the first path part into the host field. | |
if (psychotic) { | |
result.hostname = ''; | |
result.port = null; | |
if (result.host) { | |
if (srcPath[0] === '') srcPath[0] = result.host; | |
else srcPath.unshift(result.host); | |
} | |
result.host = ''; | |
if (relative.protocol) { | |
relative.hostname = null; | |
relative.port = null; | |
if (relative.host) { | |
if (relPath[0] === '') relPath[0] = relative.host; | |
else relPath.unshift(relative.host); | |
} | |
relative.host = null; | |
} | |
mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); | |
} | |
if (isRelAbs) { | |
// it's absolute. | |
result.host = (relative.host || relative.host === '') ? | |
relative.host : result.host; | |
result.hostname = (relative.hostname || relative.hostname === '') ? | |
relative.hostname : result.hostname; | |
result.search = relative.search; | |
result.query = relative.query; | |
srcPath = relPath; | |
// fall through to the dot-handling below. | |
} else if (relPath.length) { | |
// it's relative | |
// throw away the existing file, and take the new path instead. | |
if (!srcPath) srcPath = []; | |
srcPath.pop(); | |
srcPath = srcPath.concat(relPath); | |
result.search = relative.search; | |
result.query = relative.query; | |
} else if (!isNullOrUndefined(relative.search)) { | |
// just pull out the search. | |
// like href='?foo'. | |
// Put this after the other two cases because it simplifies the booleans | |
if (psychotic) { | |
result.hostname = result.host = srcPath.shift(); | |
//occationaly the auth can get stuck only in host | |
//this especialy happens in cases like | |
//url.resolveObject('mailto:local1@domain1', 'local2@domain2') | |
var authInHost = result.host && result.host.indexOf('@') > 0 ? | |
result.host.split('@') : false; | |
if (authInHost) { | |
result.auth = authInHost.shift(); | |
result.host = result.hostname = authInHost.shift(); | |
} | |
} | |
result.search = relative.search; | |
result.query = relative.query; | |
//to support http.request | |
if (!isNull(result.pathname) || !isNull(result.search)) { | |
result.path = (result.pathname ? result.pathname : '') + | |
(result.search ? result.search : ''); | |
} | |
result.href = result.format(); | |
return result; | |
} | |
if (!srcPath.length) { | |
// no path at all. easy. | |
// we've already handled the other stuff above. | |
result.pathname = null; | |
//to support http.request | |
if (result.search) { | |
result.path = '/' + result.search; | |
} else { | |
result.path = null; | |
} | |
result.href = result.format(); | |
return result; | |
} | |
// if a url ENDs in . or .., then it must get a trailing slash. | |
// however, if it ends in anything else non-slashy, | |
// then it must NOT get a trailing slash. | |
var last = srcPath.slice(-1)[0]; | |
var hasTrailingSlash = ( | |
(result.host || relative.host) && (last === '.' || last === '..') || | |
last === ''); | |
// strip single dots, resolve double dots to parent dir | |
// if the path tries to go above the root, `up` ends up > 0 | |
var up = 0; | |
for (var i = srcPath.length; i >= 0; i--) { | |
last = srcPath[i]; | |
if (last == '.') { | |
srcPath.splice(i, 1); | |
} else if (last === '..') { | |
srcPath.splice(i, 1); | |
up++; | |
} else if (up) { | |
srcPath.splice(i, 1); | |
up--; | |
} | |
} | |
// if the path is allowed to go above the root, restore leading ..s | |
if (!mustEndAbs && !removeAllDots) { | |
for (; up--; up) { | |
srcPath.unshift('..'); | |
} | |
} | |
if (mustEndAbs && srcPath[0] !== '' && | |
(!srcPath[0] || srcPath[0].charAt(0) !== '/')) { | |
srcPath.unshift(''); | |
} | |
if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { | |
srcPath.push(''); | |
} | |
var isAbsolute = srcPath[0] === '' || | |
(srcPath[0] && srcPath[0].charAt(0) === '/'); | |
// put the host back | |
if (psychotic) { | |
result.hostname = result.host = isAbsolute ? '' : | |
srcPath.length ? srcPath.shift() : ''; | |
//occationaly the auth can get stuck only in host | |
//this especialy happens in cases like | |
//url.resolveObject('mailto:local1@domain1', 'local2@domain2') | |
var authInHost = result.host && result.host.indexOf('@') > 0 ? | |
result.host.split('@') : false; | |
if (authInHost) { | |
result.auth = authInHost.shift(); | |
result.host = result.hostname = authInHost.shift(); | |
} | |
} | |
mustEndAbs = mustEndAbs || (result.host && srcPath.length); | |
if (mustEndAbs && !isAbsolute) { | |
srcPath.unshift(''); | |
} | |
if (!srcPath.length) { | |
result.pathname = null; | |
result.path = null; | |
} else { | |
result.pathname = srcPath.join('/'); | |
} | |
//to support request.http | |
if (!isNull(result.pathname) || !isNull(result.search)) { | |
result.path = (result.pathname ? result.pathname : '') + | |
(result.search ? result.search : ''); | |
} | |
result.auth = relative.auth || result.auth; | |
result.slashes = result.slashes || relative.slashes; | |
result.href = result.format(); | |
return result; | |
}; | |
Url.prototype.parseHost = function() { | |
var host = this.host; | |
var port = portPattern.exec(host); | |
if (port) { | |
port = port[0]; | |
if (port !== ':') { | |
this.port = port.substr(1); | |
} | |
host = host.substr(0, host.length - port.length); | |
} | |
if (host) this.hostname = host; | |
}; | |
function isString(arg) { | |
return typeof arg === "string"; | |
} | |
function isObject(arg) { | |
return typeof arg === 'object' && arg !== null; | |
} | |
function isNull(arg) { | |
return arg === null; | |
} | |
function isNullOrUndefined(arg) { | |
return arg == null; | |
} | |
/***/ }, | |
/* 12 */ | |
/*!****************************************************************!*\ | |
!*** (webpack)/~/node-libs-browser/~/path-browserify/index.js ***! | |
\****************************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a | |
// copy of this software and associated documentation files (the | |
// "Software"), to deal in the Software without restriction, including | |
// without limitation the rights to use, copy, modify, merge, publish, | |
// distribute, sublicense, and/or sell copies of the Software, and to permit | |
// persons to whom the Software is furnished to do so, subject to the | |
// following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included | |
// in all copies or substantial portions of the Software. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | |
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | |
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | |
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | |
// USE OR OTHER DEALINGS IN THE SOFTWARE. | |
// resolves . and .. elements in a path array with directory names there | |
// must be no slashes, empty elements, or device names (c:\) in the array | |
// (so also no leading and trailing slashes - it does not distinguish | |
// relative and absolute paths) | |
function normalizeArray(parts, allowAboveRoot) { | |
// if the path tries to go above the root, `up` ends up > 0 | |
var up = 0; | |
for (var i = parts.length - 1; i >= 0; i--) { | |
var last = parts[i]; | |
if (last === '.') { | |
parts.splice(i, 1); | |
} else if (last === '..') { | |
parts.splice(i, 1); | |
up++; | |
} else if (up) { | |
parts.splice(i, 1); | |
up--; | |
} | |
} | |
// if the path is allowed to go above the root, restore leading ..s | |
if (allowAboveRoot) { | |
for (; up--; up) { | |
parts.unshift('..'); | |
} | |
} | |
return parts; | |
} | |
// Split a filename into [root, dir, basename, ext], unix version | |
// 'root' is just a slash, or nothing. | |
var splitPathRe = | |
/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; | |
var splitPath = function(filename) { | |
return splitPathRe.exec(filename).slice(1); | |
}; | |
// path.resolve([from ...], to) | |
// posix version | |
exports.resolve = function() { | |
var resolvedPath = '', | |
resolvedAbsolute = false; | |
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { | |
var path = (i >= 0) ? arguments[i] : process.cwd(); | |
// Skip empty and invalid entries | |
if (typeof path !== 'string') { | |
throw new TypeError('Arguments to path.resolve must be strings'); | |
} else if (!path) { | |
continue; | |
} | |
resolvedPath = path + '/' + resolvedPath; | |
resolvedAbsolute = path.charAt(0) === '/'; | |
} | |
// At this point the path should be resolved to a full absolute path, but | |
// handle relative paths to be safe (might happen when process.cwd() fails) | |
// Normalize the path | |
resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { | |
return !!p; | |
}), !resolvedAbsolute).join('/'); | |
return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; | |
}; | |
// path.normalize(path) | |
// posix version | |
exports.normalize = function(path) { | |
var isAbsolute = exports.isAbsolute(path), | |
trailingSlash = substr(path, -1) === '/'; | |
// Normalize the path | |
path = normalizeArray(filter(path.split('/'), function(p) { | |
return !!p; | |
}), !isAbsolute).join('/'); | |
if (!path && !isAbsolute) { | |
path = '.'; | |
} | |
if (path && trailingSlash) { | |
path += '/'; | |
} | |
return (isAbsolute ? '/' : '') + path; | |
}; | |
// posix version | |
exports.isAbsolute = function(path) { | |
return path.charAt(0) === '/'; | |
}; | |
// posix version | |
exports.join = function() { | |
var paths = Array.prototype.slice.call(arguments, 0); | |
return exports.normalize(filter(paths, function(p, index) { | |
if (typeof p !== 'string') { | |
throw new TypeError('Arguments to path.join must be strings'); | |
} | |
return p; | |
}).join('/')); | |
}; | |
// path.relative(from, to) | |
// posix version | |
exports.relative = function(from, to) { | |
from = exports.resolve(from).substr(1); | |
to = exports.resolve(to).substr(1); | |
function trim(arr) { | |
var start = 0; | |
for (; start < arr.length; start++) { | |
if (arr[start] !== '') break; | |
} | |
var end = arr.length - 1; | |
for (; end >= 0; end--) { | |
if (arr[end] !== '') break; | |
} | |
if (start > end) return []; | |
return arr.slice(start, end - start + 1); | |
} | |
var fromParts = trim(from.split('/')); | |
var toParts = trim(to.split('/')); | |
var length = Math.min(fromParts.length, toParts.length); | |
var samePartsLength = length; | |
for (var i = 0; i < length; i++) { | |
if (fromParts[i] !== toParts[i]) { | |
samePartsLength = i; | |
break; | |
} | |
} | |
var outputParts = []; | |
for (var i = samePartsLength; i < fromParts.length; i++) { | |
outputParts.push('..'); | |
} | |
outputParts = outputParts.concat(toParts.slice(samePartsLength)); | |
return outputParts.join('/'); | |
}; | |
exports.sep = '/'; | |
exports.delimiter = ':'; | |
exports.dirname = function(path) { | |
var result = splitPath(path), | |
root = result[0], | |
dir = result[1]; | |
if (!root && !dir) { | |
// No dirname whatsoever | |
return '.'; | |
} | |
if (dir) { | |
// It has a dirname, strip trailing slash | |
dir = dir.substr(0, dir.length - 1); | |
} | |
return root + dir; | |
}; | |
exports.basename = function(path, ext) { | |
var f = splitPath(path)[2]; | |
// TODO: make this comparison case-insensitive on windows? | |
if (ext && f.substr(-1 * ext.length) === ext) { | |
f = f.substr(0, f.length - ext.length); | |
} | |
return f; | |
}; | |
exports.extname = function(path) { | |
return splitPath(path)[3]; | |
}; | |
function filter (xs, f) { | |
if (xs.filter) return xs.filter(f); | |
var res = []; | |
for (var i = 0; i < xs.length; i++) { | |
if (f(xs[i], i, xs)) res.push(xs[i]); | |
} | |
return res; | |
} | |
// String.prototype.substr - negative index don't work in IE8 | |
var substr = 'ab'.substr(-1) === 'b' | |
? function (str, start, len) { return str.substr(start, len) } | |
: function (str, start, len) { | |
if (start < 0) start = str.length + start; | |
return str.substr(start, len); | |
} | |
; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! (webpack)/~/node-libs-browser/~/process/browser.js */ 13))) | |
/***/ }, | |
/* 13 */ | |
/*!**********************************************************!*\ | |
!*** (webpack)/~/node-libs-browser/~/process/browser.js ***! | |
\**********************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
// shim for using process in browser | |
var process = module.exports = {}; | |
process.nextTick = (function () { | |
var canSetImmediate = typeof window !== 'undefined' | |
&& window.setImmediate; | |
var canPost = typeof window !== 'undefined' | |
&& window.postMessage && window.addEventListener | |
; | |
if (canSetImmediate) { | |
return function (f) { return window.setImmediate(f) }; | |
} | |
if (canPost) { | |
var queue = []; | |
window.addEventListener('message', function (ev) { | |
var source = ev.source; | |
if ((source === window || source === null) && ev.data === 'process-tick') { | |
ev.stopPropagation(); | |
if (queue.length > 0) { | |
var fn = queue.shift(); | |
fn(); | |
} | |
} | |
}, true); | |
return function nextTick(fn) { | |
queue.push(fn); | |
window.postMessage('process-tick', '*'); | |
}; | |
} | |
return function nextTick(fn) { | |
setTimeout(fn, 0); | |
}; | |
})(); | |
process.title = 'browser'; | |
process.browser = true; | |
process.env = {}; | |
process.argv = []; | |
function noop() {} | |
process.on = noop; | |
process.addListener = noop; | |
process.once = noop; | |
process.off = noop; | |
process.removeListener = noop; | |
process.removeAllListeners = noop; | |
process.emit = noop; | |
process.binding = function (name) { | |
throw new Error('process.binding is not supported'); | |
} | |
// TODO(shtylman) | |
process.cwd = function () { return '/' }; | |
process.chdir = function (dir) { | |
throw new Error('process.chdir is not supported'); | |
}; | |
/***/ }, | |
/* 14 */ | |
/*!***************************************************!*\ | |
!*** (webpack)/~/node-libs-browser/mock/empty.js ***! | |
\***************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
/***/ }, | |
/* 15 */ | |
/*!*************************!*\ | |
!*** external "canvas" ***! | |
\*************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
if(typeof canvas === 'undefined') {var e = new Error("Cannot find module \"canvas\""); e.code = 'MODULE_NOT_FOUND'; throw e;} | |
module.exports = canvas; | |
/***/ }, | |
/* 16 */ | |
/*!**********************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/contextify-shim.js ***! | |
\**********************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
module.exports = function (o) { | |
o.getGlobal = function () { | |
return o; | |
}; | |
}; | |
/***/ }, | |
/* 17 */ | |
/*!******************************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/browser/documentAdapter.js ***! | |
\******************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//Tree traversing | |
exports.getFirstChild = function (node) { | |
return node.childNodes[0]; | |
}; | |
exports.getChildNodes = function (node) { | |
return node.childNodes; | |
}; | |
exports.getParentNode = function (node) { | |
return node.parentNode; | |
}; | |
exports.getAttrList = function (node) { | |
return node.attributes; | |
}; | |
//Node data | |
exports.getTagName = function (element) { | |
return element.tagName.toLowerCase(); | |
}; | |
exports.getNamespaceURI = function (element) { | |
return element.namespaceURI || 'http://www.w3.org/1999/xhtml'; | |
}; | |
exports.getTextNodeContent = function (textNode) { | |
return textNode.nodeValue; | |
}; | |
exports.getCommentNodeContent = function (commentNode) { | |
return commentNode.nodeValue; | |
}; | |
exports.getDocumentTypeNodeName = function (doctypeNode) { | |
return doctypeNode.name; | |
}; | |
exports.getDocumentTypeNodePublicId = function (doctypeNode) { | |
return doctypeNode.publicId || null; | |
}; | |
exports.getDocumentTypeNodeSystemId = function (doctypeNode) { | |
return doctypeNode.systemId || null; | |
}; | |
//Node types | |
exports.isTextNode = function (node) { | |
return node.nodeName === '#text'; | |
}; | |
exports.isCommentNode = function (node) { | |
return node.nodeName === '#comment'; | |
}; | |
exports.isDocumentTypeNode = function (node) { | |
return node.nodeType === 10; | |
}; | |
exports.isElementNode = function (node) { | |
return !!node.tagName; | |
}; | |
/***/ }, | |
/* 18 */ | |
/*!**********************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/browser/history.js ***! | |
\**********************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(process) {"use strict"; | |
var URL = __webpack_require__(/*! url */ 11); | |
function StateEntry(data, title, url) { | |
this.data = data; | |
this.title = title; | |
this.url = url; | |
} | |
module.exports = History; | |
function History(window) { | |
this._states = []; | |
this._index = -1; | |
this._window = window; | |
this._location = window.location; | |
} | |
History.prototype = { | |
constructor: History, | |
get length() { | |
return this._states.length; | |
}, | |
get state() { | |
var state = this._states[this._index]; | |
return state ? state.data : null; | |
}, | |
back: function () { | |
this.go(-1); | |
}, | |
forward: function () { | |
this.go(1); | |
}, | |
go: function (delta) { | |
if (typeof delta === "undefined" || delta === 0) { | |
this._location.reload(); | |
return; | |
} | |
var newIndex = this._index + delta; | |
if (newIndex < 0 || newIndex >= this.length) { | |
return; | |
} | |
this._index = newIndex; | |
this._applyState(this._states[this._index]); | |
}, | |
pushState: function (data, title, url) { | |
var state = new StateEntry(data, title, url); | |
if (this._index + 1 !== this._states.length) { | |
this._states = this._states.slice(0, this._index + 1); | |
} | |
this._states.push(state); | |
this._applyState(state); | |
this._index++; | |
}, | |
replaceState: function (data, title, url) { | |
var state = new StateEntry(data, title, url); | |
this._states[this._index] = state; | |
this._applyState(state); | |
}, | |
_applyState: function(state) { | |
this._location._url = URL.parse(URL.resolve(this._location._url.href, state.url)); | |
this._signalPopstate(state); | |
}, | |
_signalPopstate: function(state) { | |
if (this._window.document) { | |
var ev = this._window.document.createEvent("HTMLEvents"); | |
ev.initEvent("popstate", false, false); | |
ev.state = state.data; | |
process.nextTick(function () { | |
this._window.dispatchEvent(ev); | |
}.bind(this)); | |
} | |
}, | |
toString: function () { | |
return "[object History]"; | |
} | |
}; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! (webpack)/~/node-libs-browser/~/process/browser.js */ 13))) | |
/***/ }, | |
/* 19 */ | |
/*!************************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/browser/htmltodom.js ***! | |
\************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var parse5 = __webpack_require__(/*! parse5 */ 39); | |
var htmlparser2 = __webpack_require__(/*! htmlparser2 */ 45); | |
function HtmlToDom(parser, parsingMode) { | |
if (!parser) { | |
if (parsingMode === "xml") { | |
parser = htmlparser2; | |
} else { | |
parser = parse5; | |
} | |
} | |
if (parser.DefaultHandler || (parser.Parser && parser.TreeAdapters)) { | |
// Forgiving HTML parser | |
if (parser.DefaultHandler){ | |
// fb55/htmlparser2 | |
parser.ParseHtml = function(rawHtml) { | |
var handler = new parser.DefaultHandler(); | |
// Check if document is XML | |
var isXML = parsingMode === "xml"; | |
var parserInstance = new parser.Parser(handler, { | |
xmlMode: isXML, | |
lowerCaseTags: !isXML, | |
lowerCaseAttributeNames: !isXML, | |
decodeEntities: true | |
}); | |
parserInstance.includeLocation = false; | |
parserInstance.parseComplete(rawHtml); | |
return handler.dom; | |
}; | |
} else if (parser.Parser && parser.TreeAdapters) { | |
parser.ParseHtml = function (rawHtml) { | |
if (parsingMode === 'xml') { | |
throw new Error('Can\'t parse XML with parse5, please use htmlparser2 instead.'); | |
} | |
var instance = new parser.Parser(parser.TreeAdapters.htmlparser2); | |
var dom = instance.parse(rawHtml); | |
return dom.children; | |
}; | |
} | |
this.appendHtmlToElement = function(html, element) { | |
if (typeof html !== 'string') { | |
html +=''; | |
} | |
var parsed = parser.ParseHtml(html); | |
for (var i = 0; i < parsed.length; i++) { | |
setChild(element, parsed[i]); | |
} | |
return element; | |
}; | |
this.appendHtmlToDocument = this.appendHtmlToElement; | |
if (parser.Parser && parser.TreeAdapters) { | |
this.appendHtmlToElement = function (html, element) { | |
if (typeof html !== 'string') { | |
html += ''; | |
} | |
var instance = new parser.Parser(parser.TreeAdapters.htmlparser2); | |
var parentElement = parser.TreeAdapters.htmlparser2.createElement(element.tagName.toLowerCase(), element.namespaceURI, []); | |
var dom = instance.parseFragment(html, parentElement); | |
var parsed = dom.children; | |
for (var i = 0; i < parsed.length; i++) { | |
setChild(element, parsed[i]); | |
} | |
return element; | |
}; | |
} | |
} else if (parser.moduleName == 'HTML5') { /* HTML5 parser */ | |
this.appendHtmlToElement = function(html, element) { | |
if (typeof html !== 'string') { | |
html += ''; | |
} | |
if (html.length > 0) { | |
if (element.nodeType == 9) { | |
new parser.Parser({document: element}).parse(html); | |
} | |
else { | |
var p = new parser.Parser({document: element.ownerDocument}); | |
p.parse_fragment(html, element); | |
} | |
} | |
}; | |
} else { | |
this.appendHtmlToElement = function () { | |
console.log(''); | |
console.log('###########################################################'); | |
console.log('# WARNING: No compatible HTML parser was given.'); | |
console.log('# Element.innerHTML setter support has been disabled'); | |
console.log('# Element.innerHTML getter support will still function'); | |
console.log('###########################################################'); | |
console.log(''); | |
}; | |
} | |
}; | |
// utility function for forgiving parser | |
function setChild(parent, node) { | |
var c, newNode, currentDocument = parent._ownerDocument || parent; | |
switch (node.type) | |
{ | |
case 'tag': | |
case 'script': | |
case 'style': | |
try { | |
newNode = currentDocument._createElementNoTagNameValidation(node.name); | |
newNode._namespaceURI = node.namespace || "http://www.w3.org/1999/xhtml"; | |
if (node.location) { | |
newNode.sourceLocation = node.location; | |
newNode.sourceLocation.file = parent.sourceLocation.file; | |
} | |
} catch (err) { | |
currentDocument.raise('error', 'invalid markup', { | |
exception: err, | |
node : node | |
}); | |
return null; | |
} | |
break; | |
case 'text': | |
// HTML entities should already be decoded by the parser, so no need to decode them | |
newNode = currentDocument.createTextNode(node.data); | |
break; | |
case 'comment': | |
newNode = currentDocument.createComment(node.data); | |
break; | |
default: | |
return null; | |
break; | |
} | |
if (!newNode) | |
return null; | |
newNode._localName = node.name; | |
if (node.attribs) { | |
for (c in node.attribs) { | |
var prefix = node['x-attribsPrefix'] && node['x-attribsPrefix'][c] ? node['x-attribsPrefix'][c] + ':' : ''; | |
// catchin errors here helps with improperly escaped attributes | |
// but properly fixing parent should (can only?) be done in the htmlparser itself | |
try { | |
newNode.setAttribute(prefix + c, node.attribs[c]); | |
newNode.attributes[prefix + c]._namespaceURI = node['x-attribsNamespace'][c] || null; | |
newNode.attributes[prefix + c]._prefix = node['x-attribsPrefix'][c] || null; | |
newNode.attributes[prefix + c]._localName = c; | |
} catch(e2) { /* noop */ } | |
} | |
} | |
if (node.children) { | |
for (c = 0; c < node.children.length; c++) { | |
setChild(newNode, node.children[c]); | |
} | |
} | |
try{ | |
return parent.appendChild(newNode); | |
}catch(err){ | |
currentDocument.raise('error', err.message, { | |
exception: err, | |
node : node | |
}); | |
return null; | |
} | |
} | |
exports.HtmlToDom = HtmlToDom; | |
/***/ }, | |
/* 20 */ | |
/*!***********************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/browser/location.js ***! | |
\***********************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(process) {"use strict"; | |
var URL = __webpack_require__(/*! url */ 11); | |
var NOT_IMPLEMENTED = __webpack_require__(/*! ./utils */ 21).NOT_IMPLEMENTED; | |
module.exports = Location; | |
function Location(urlString, window) { | |
this._url = URL.parse(urlString); | |
this._window = window; | |
} | |
Location.prototype = { | |
constructor: Location, | |
reload: function () { | |
NOT_IMPLEMENTED(this._window, "location.reload")(); | |
}, | |
get protocol() { return this._url.protocol || ":"; }, | |
get host() { return this._url.host || ""; }, | |
get auth() { return this._url.auth; }, | |
get hostname() { return this._url.hostname || ""; }, | |
get origin() { return ((this._url.protocol !== undefined && this._url.protocol !== null) ? this._url.protocol + "//" : this._url.protocol) + this._url.host || ""; }, | |
get port() { return this._url.port || ""; }, | |
get pathname() { return this._url.pathname || ""; }, | |
get href() { return this._url.href; }, | |
get hash() { return this._url.hash || ""; }, | |
get search() { return this._url.search || ""; }, | |
set href(val) { | |
var oldUrl = this._url.href; | |
var oldProtocol = this._url.protocol; | |
var oldHost = this._url.host; | |
var oldPathname = this._url.pathname; | |
var oldHash = this._url.hash || ""; | |
this._url = URL.parse(URL.resolve(oldUrl, val)); | |
var newUrl = this._url.href; | |
var newProtocol = this._url.protocol; | |
var newHost = this._url.host; | |
var newPathname = this._url.pathname; | |
var newHash = this._url.hash || ""; | |
if (oldProtocol === newProtocol && oldHost === newHost && oldPathname === newPathname && oldHash !== newHash) { | |
this._signalHashChange(oldUrl, newUrl); | |
} else { | |
NOT_IMPLEMENTED(this._window, "location.href (no reload)")(); | |
} | |
}, | |
set hash(val) { | |
var oldUrl = this._url.href; | |
var oldHash = this._url.hash || ""; | |
if (val.lastIndexOf("#", 0) !== 0) { | |
val = "#" + val; | |
} | |
this._url = URL.parse(URL.resolve(oldUrl, val)); | |
var newUrl = this._url.href; | |
var newHash = this._url.hash || ""; | |
if (oldHash !== newHash) { | |
this._signalHashChange(oldUrl, newUrl); | |
} | |
}, | |
set search(val) { | |
var oldUrl = this._url.href; | |
var oldHash = this._url.hash || ""; | |
if (val.length) { | |
if (val.lastIndexOf("?", 0) !== 0) { | |
val = "?" + val; | |
} | |
this._url = URL.parse(URL.resolve(oldUrl, val + oldHash)); | |
} else { | |
this._url = URL.parse(oldUrl.replace(/\?([^#]+)/, "")); | |
} | |
}, | |
replace: function (val) { | |
this.href = val; | |
}, | |
toString: function () { | |
return this._url.href; | |
}, | |
_signalHashChange: function (oldUrl, newUrl) { | |
if (this._window.document) { | |
var ev = this._window.document.createEvent("HTMLEvents"); | |
ev.initEvent("hashchange", false, false); | |
ev.oldUrl = oldUrl; | |
ev.newUrl = newUrl; | |
process.nextTick(function () { | |
this._window.dispatchEvent(ev); | |
}.bind(this)); | |
} | |
} | |
}; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! (webpack)/~/node-libs-browser/~/process/browser.js */ 13))) | |
/***/ }, | |
/* 21 */ | |
/*!********************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/browser/utils.js ***! | |
\********************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
"use strict"; | |
var jsdom = __webpack_require__(/*! ../../jsdom */ 1); | |
exports.NOT_IMPLEMENTED = function (target, nameForErrorMessage) { | |
return function () { | |
if (!jsdom.debugMode) { | |
var raise = target ? target.raise : this.raise; | |
raise.call(this, "error", "NOT IMPLEMENTED" + (nameForErrorMessage ? ": " + nameForErrorMessage : "")); | |
} | |
}; | |
}; | |
/***/ }, | |
/* 22 */ | |
/*!******************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/level2/core.js ***! | |
\******************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var core = __webpack_require__(/*! ../level1/core */ 29).dom.level1.core; | |
var defineGetter = __webpack_require__(/*! ../utils */ 3).defineGetter; | |
var defineSetter = __webpack_require__(/*! ../utils */ 3).defineSetter; | |
// modify cloned instance for more info check: https://github.com/tmpvar/jsdom/issues/325 | |
core = Object.create(core); | |
var INVALID_STATE_ERR = core.INVALID_STATE_ERR = 11, | |
SYNTAX_ERR = core.SYNTAX_ERR = 12, | |
INVALID_MODIFICATION_ERR = core.INVALID_MODIFICATION_ERR = 13, | |
NAMESPACE_ERR = core.NAMESPACE_ERR = 14, | |
INVALID_ACCESS_ERR = core.INVALID_ACCESS_ERR = 15, | |
ns = { | |
validate : function(ns, URI) { | |
if (!ns) { | |
throw new core.DOMException(core.INVALID_CHARACTER_ERR, "namespace is undefined"); | |
} | |
if(ns.match(/[^0-9a-z\.:\-_]/i) !== null) { | |
throw new core.DOMException(core.INVALID_CHARACTER_ERR, ns); | |
} | |
var msg = false, parts = ns.split(':'); | |
if (ns === 'xmlns' && | |
URI !== "http://www.w3.org/2000/xmlns/") | |
{ | |
msg = "localName is 'xmlns' but the namespaceURI is invalid"; | |
} else if (ns === "xml" && | |
URI !== "http://www.w3.org/XML/1998/namespace") | |
{ | |
msg = "localName is 'xml' but the namespaceURI is invalid"; | |
} else if (ns[ns.length-1] === ':') { | |
msg = "Namespace seperator found with no localName"; | |
} else if (ns[0] === ':') { | |
msg = "Namespace seperator found, without a prefix"; | |
} else if (parts.length > 2) { | |
msg = "Too many namespace seperators"; | |
} | |
if (msg) { | |
throw new core.DOMException(NAMESPACE_ERR, msg + " (" + ns + "@" + URI + ")"); | |
} | |
} | |
}; | |
core.exceptionMessages['NAMESPACE_ERR'] = "Invalid namespace"; | |
core.DOMImplementation.prototype.createDocumentType = function(/* String */ qualifiedName, | |
/* String */ publicId, | |
/* String */ systemId) | |
{ | |
ns.validate(qualifiedName); | |
var doctype = new core.DocumentType(null, qualifiedName); | |
doctype._publicId = String(publicId); | |
doctype._systemId = String(systemId); | |
return doctype; | |
}; | |
/** | |
Creates an XML Document object of the specified type with its document element. | |
HTML-only DOM implementations do not need to implement this method. | |
*/ | |
core.DOMImplementation.prototype.createDocument = function(/* String */ namespaceURI, | |
/* String */ qualifiedName, | |
/* DocumentType */ doctype) | |
{ | |
if (qualifiedName || namespaceURI) { | |
ns.validate(qualifiedName, namespaceURI); | |
} | |
if (doctype && doctype._ownerDocument !== null) { | |
throw new core.DOMException(core.WRONG_DOCUMENT_ERR); | |
} | |
if (qualifiedName && qualifiedName.indexOf(':') > -1 && !namespaceURI) { | |
throw new core.DOMException(NAMESPACE_ERR); | |
} | |
var document = new core.Document(); | |
if (doctype) { | |
document.doctype = doctype; | |
doctype._ownerDocument = document; | |
document.appendChild(doctype); | |
} else { | |
document.doctype = null; | |
} | |
if (doctype && !doctype.entities) { | |
doctype.entities = new core.EntityNodeMap(); | |
} | |
document._ownerDocument = document; | |
if (qualifiedName) { | |
var docElement = document.createElementNS(namespaceURI, qualifiedName); | |
document.appendChild(docElement); | |
} | |
return document; | |
}; | |
defineGetter(core.Node.prototype, "ownerDocument", function() { | |
return this._ownerDocument || null; | |
}); | |
core.Node.prototype.isSupported = function(/* string */ feature, | |
/* string */ version) | |
{ | |
return this._ownerDocument.implementation.hasFeature(feature, version); | |
}; | |
core.Node.prototype._namespaceURI = null; | |
defineGetter(core.Node.prototype, "namespaceURI", function() { | |
return this._namespaceURI || null; | |
}); | |
defineSetter(core.Node.prototype, "namespaceURI", function(value) { | |
this._namespaceURI = value; | |
}); | |
defineGetter(core.Node.prototype, "prefix", function() { | |
return this._prefix || null; | |
}); | |
defineSetter(core.Node.prototype, "prefix", function(value) { | |
if (this.readonly) { | |
throw new core.DOMException(core.NO_MODIFICATION_ALLOWED_ERR); | |
} | |
ns.validate(value, this._namespaceURI); | |
if ((this._created && !this._namespaceURI) || | |
this._prefix === "xmlns" || | |
(!this._prefix && this._created)) | |
{ | |
throw new core.DOMException(core.NAMESPACE_ERR); | |
} | |
if (this._localName) { | |
this._nodeName = value + ':' + this._localName; | |
} | |
this._prefix = value; | |
}); | |
defineGetter(core.Node.prototype, "localName", function() { | |
return this._localName || null; | |
}); | |
/* return boolean */ | |
core.Node.prototype.hasAttributes = function() { | |
return (this.nodeType === this.ELEMENT_NODE && | |
this._attributes && | |
this._attributes.length > 0); | |
}; | |
core.NamedNodeMap.prototype.getNamedItemNS = function(/* string */ namespaceURI, | |
/* string */ localName) | |
{ | |
if (this._nsStore[namespaceURI] && this._nsStore[namespaceURI][localName]) { | |
return this._nsStore[namespaceURI][localName]; | |
} | |
return null; | |
}; | |
core.NamedNodeMap.prototype.setNamedItemNS = function(/* Node */ arg) | |
{ | |
if (this._readonly) { | |
throw new core.DOMException(core.NO_MODIFICATION_ALLOWED_ERR); | |
} | |
var owner = this._ownerDocument; | |
if (this._parentNode && | |
this._parentNode._parentNode && | |
this._parentNode._parentNode.nodeType === owner.ENTITY_NODE) | |
{ | |
throw new core.DOMException(core.NO_MODIFICATION_ALLOWED_ERR); | |
} | |
if (this._ownerDocument !== arg.ownerDocument) { | |
throw new core.DOMException(core.WRONG_DOCUMENT_ERR); | |
} | |
if (arg._ownerElement) { | |
throw new core.DOMException(core.INUSE_ATTRIBUTE_ERR); | |
} | |
// readonly | |
if (this._readonly === true) { | |
throw new core.DOMException(core.NO_MODIFICATION_ALLOWED_ERR); | |
} | |
if (!this._nsStore[arg.namespaceURI]) { | |
this._nsStore[arg.namespaceURI] = {}; | |
} | |
var existing = null; | |
if (this._nsStore[arg.namespaceURI][arg.localName]) { | |
var existing = this._nsStore[arg.namespaceURI][arg.localName]; | |
} | |
this._nsStore[arg.namespaceURI][arg.localName] = arg; | |
arg._specified = true; | |
arg._ownerDocument = this._ownerDocument; | |
return this.setNamedItem(arg); | |
}; | |
core.NamedNodeMap.prototype.removeNamedItemNS = function(/*string */ namespaceURI, | |
/* string */ localName) | |
{ | |
if (this.readonly) { | |
throw new core.DOMException(core.NO_MODIFICATION_ALLOWED_ERR); | |
} | |
var parent = this._parentNode, | |
found = null, | |
defaults, | |
clone, | |
defaultEl, | |
defaultAttr; | |
if (this._parentNode && | |
this._parentNode._parentNode && | |
this._parentNode._parentNode.nodeType === this._ownerDocument.ENTITY_NODE) | |
{ | |
throw new core.DOMException(core.NO_MODIFICATION_ALLOWED_ERR); | |
} | |
if (this._nsStore[namespaceURI] && | |
this._nsStore[namespaceURI][localName]) | |
{ | |
found = this._nsStore[namespaceURI][localName]; | |
this.removeNamedItem(found.qualifiedName); | |
delete this._nsStore[namespaceURI][localName]; | |
} | |
if (!found) { | |
throw new core.DOMException(core.NOT_FOUND_ERR); | |
} | |
if (parent.ownerDocument.doctype && parent.ownerDocument.doctype._attributes) { | |
defaults = parent.ownerDocument.doctype._attributes; | |
defaultEl = defaults.getNamedItemNS(parent._namespaceURI, parent._localName); | |
} | |
if (defaultEl) { | |
defaultAttr = defaultEl._attributes.getNamedItemNS(namespaceURI, localName); | |
if (defaultAttr) { | |
clone = defaultAttr.cloneNode(true); | |
clone._created = false; | |
clone._namespaceURI = found._namespaceURI; | |
clone._nodeName = found.name; | |
clone._localName = found._localName; | |
clone._prefix = found._prefix | |
this.setNamedItemNS(clone); | |
clone._created = true; | |
clone._specified = false; | |
} | |
} | |
return found; | |
}; | |
defineGetter(core.Attr.prototype, "ownerElement", function() { | |
return this._ownerElement || null; | |
}); | |
core.Node.prototype._prefix = false; | |
defineSetter(core.Node.prototype, "qualifiedName", function(qualifiedName) { | |
ns.validate(qualifiedName, this._namespaceURI); | |
qualifiedName = qualifiedName || ""; | |
this._localName = qualifiedName.split(":")[1] || null; | |
this.prefix = qualifiedName.split(":")[0] || null; | |
this._nodeName = qualifiedName; | |
}); | |
defineGetter(core.Node.prototype, "qualifiedName", function() { | |
return this._nodeName; | |
}); | |
core.NamedNodeMap.prototype._map = function(fn) { | |
var ret = [], l = this.length, i = 0, node; | |
for(i; i<l; i++) { | |
node = this.item(i); | |
if (fn && fn(node)) { | |
ret.push(node); | |
} | |
} | |
return ret; | |
}; | |
core.Element.prototype.getAttribute = function(/* string */ name) | |
{ | |
var attr = this.getAttributeNode(name); | |
return attr && attr.value; | |
}; | |
core.Element.prototype.getAttributeNode = function(/* string */ name) | |
{ | |
return this._attributes.$getNoNS(name); | |
}; | |
core.Element.prototype.removeAttribute = function(/* string */ name) | |
{ | |
return this._attributes.$removeNoNS(name); | |
}; | |
core.Element.prototype.getAttributeNS = function(/* string */ namespaceURI, | |
/* string */ localName) | |
{ | |
if (namespaceURI === "") { | |
namespaceURI = null; | |
} | |
var attr = this._attributes.$getNode(namespaceURI, localName); | |
return attr && attr.value; | |
}; | |
core.Element.prototype.setAttribute = function(/* string */ name, | |
/* string */ value) | |
{ | |
this._attributes.$setNoNS(name, value); | |
}; | |
core.Element.prototype.setAttributeNS = function(/* string */ namespaceURI, | |
/* string */ qualifiedName, | |
/* string */ value) | |
{ | |
if (namespaceURI === "") { | |
namespaceURI = null; | |
} | |
var s = qualifiedName.split(':'), | |
local = s.pop(), | |
prefix = s.pop() || null, | |
attr; | |
ns.validate(qualifiedName, namespaceURI); | |
if (prefix !== null && !namespaceURI) { | |
throw new core.DOMException(core.NAMESPACE_ERR); | |
} | |
if (prefix === "xml" && | |
namespaceURI !== "http://www.w3.org/XML/1998/namespace") { | |
throw new core.DOMException(core.NAMESPACE_ERR); | |
} | |
if (prefix === "xmlns" && namespaceURI !== "http://www.w3.org/2000/xmlns/") { | |
throw new core.DOMException(core.NAMESPACE_ERR); | |
} | |
this._attributes.$set(local, value, qualifiedName, prefix, namespaceURI); | |
}; | |
core.Element.prototype.removeAttributeNS = function(/* string */ namespaceURI, | |
/* string */ localName) | |
{ | |
if (namespaceURI === "") { | |
namespaceURI = null; | |
} | |
this._attributes.$remove(namespaceURI, localName); | |
}; | |
core.Element.prototype.getAttributeNodeNS = function(/* string */ namespaceURI, | |
/* string */ localName) | |
{ | |
if (namespaceURI === "") { | |
namespaceURI = null; | |
} | |
return this._attributes.$getNode(namespaceURI, localName); | |
}; | |
core.Element.prototype._created = false; | |
core.Element.prototype.setAttributeNodeNS = function(/* Attr */ newAttr) | |
{ | |
if (newAttr.ownerElement) { | |
throw new core.DOMException(core.INUSE_ATTRIBUTE_ERR); | |
} | |
return this._attributes.$setNode(newAttr); | |
}; | |
core.Element.prototype.getElementsByTagNameNS = core.memoizeQuery(function(/* String */ namespaceURI, | |
/* String */ localName) | |
{ | |
var nsPrefixCache = {}; | |
function filterByTagName(child) { | |
if (child.nodeType && child.nodeType === this.ENTITY_REFERENCE_NODE) { | |
child = child._entity; | |
} | |
var localMatch = child.localName === localName, | |
nsMatch = child.namespaceURI === namespaceURI; | |
if ((localMatch || localName === "*") && | |
(nsMatch || namespaceURI === "*")) | |
{ | |
if (child.nodeType === child.ELEMENT_NODE) { | |
return true; | |
} | |
} | |
return false; | |
} | |
return new core.NodeList(this.ownerDocument || this, | |
core.mapper(this, filterByTagName)); | |
}); | |
core.Element.prototype.hasAttribute = function(/* string */name) | |
{ | |
if (!this._attributes) { | |
return false; | |
} | |
return !!this._attributes.$getNoNS(name); | |
}; | |
core.Element.prototype.hasAttributeNS = function(/* string */namespaceURI, | |
/* string */localName) | |
{ | |
if (namespaceURI === "") { | |
namespaceURI = null; | |
} | |
return (this._attributes.getNamedItemNS(namespaceURI, localName) || | |
this.hasAttribute(localName)); | |
}; | |
defineGetter(core.DocumentType.prototype, "publicId", function() { | |
return this._publicId || ""; | |
}); | |
defineGetter(core.DocumentType.prototype, "systemId", function() { | |
return this._systemId || ""; | |
}); | |
defineGetter(core.DocumentType.prototype, "internalSubset", function() { | |
return this._internalSubset || null; | |
}); | |
core.Document.prototype.importNode = function(/* Node */ importedNode, | |
/* bool */ deep) | |
{ | |
if (importedNode && importedNode.nodeType) { | |
if (importedNode.nodeType === this.DOCUMENT_NODE || | |
importedNode.nodeType === this.DOCUMENT_TYPE_NODE) { | |
throw new core.DOMException(core.NOT_SUPPORTED_ERR); | |
} | |
} | |
var self = this, | |
newNode = importedNode.cloneNode(deep, function(a, b) { | |
b._namespaceURI = a._namespaceURI; | |
b._nodeName = a._nodeName; | |
b._localName = a._localName; | |
}), | |
defaults = false, | |
defaultEl; | |
if (this.doctype && this.doctype._attributes) { | |
defaults = this.doctype._attributes; | |
} | |
function lastChance(el) { | |
var attr, defaultEl, i, len; | |
el._ownerDocument = self; | |
if (el.id) { | |
if (!self._ids) {self._ids = {};} | |
if (!self._ids[el.id]) {self._ids[el.id] = [];} | |
self._ids[el.id].push(el); | |
} | |
if (el._attributes) { | |
var drop = []; | |
el._attributes._ownerDocument = self; | |
for (i=0,len=el._attributes.length; i < len; i++) { | |
attr = el._attributes[i]; | |
// Attributes nodes that were expressing default values in the | |
// original document must not be copied over. Record them. | |
if (!attr._specified) { | |
drop.push(attr); | |
continue; | |
} | |
attr._ownerDocument = self; | |
} | |
// Remove obsolete default nodes. | |
for(i = 0; i < drop.length; ++i) { | |
el._attributes.$removeNode(drop[i]); | |
} | |
} | |
if (defaults) { | |
defaultEl = defaults.getNamedItemNS(el._namespaceURI, | |
el._localName); | |
// TODO: This could use some love | |
if (defaultEl) { | |
for(i = 0; i < defaultEl._attributes.length; ++i) { | |
var defaultAttr = defaultEl._attributes[i]; | |
if (!el.hasAttributeNS(defaultAttr.namespaceURL, | |
defaultAttr.localName)) | |
{ | |
var clone = defaultAttr.cloneNode(true); | |
clone._namespaceURI = defaultAttr._namespaceURI; | |
clone._prefix = defaultAttr._prefix; | |
clone._localName = defaultAttr._localName; | |
el.setAttributeNodeNS(clone); | |
clone._specified = false; | |
} | |
} | |
} | |
} | |
} | |
if (deep) { | |
core.visitTree(newNode, lastChance); | |
} | |
else { | |
lastChance(newNode); | |
} | |
if (newNode.nodeType == newNode.ATTRIBUTE_NODE) { | |
newNode._specified = true; | |
} | |
return newNode; | |
}; | |
core.Document.prototype.createElementNS = function(/* string */ namespaceURI, | |
/* string */ qualifiedName) | |
{ | |
var parts = qualifiedName.split(':'), | |
element, prefix; | |
if (parts.length > 1 && !namespaceURI) { | |
throw new core.DOMException(core.NAMESPACE_ERR); | |
} | |
ns.validate(qualifiedName, namespaceURI); | |
element = this.createElement(qualifiedName), | |
element._created = false; | |
element._namespaceURI = namespaceURI; | |
element._nodeName = qualifiedName; | |
element._localName = parts.pop(); | |
if (parts.length > 0) { | |
prefix = parts.pop(); | |
element.prefix = prefix; | |
} | |
element._created = true; | |
return element; | |
}; | |
core.Document.prototype.createAttributeNS = function(/* string */ namespaceURI, | |
/* string */ qualifiedName) | |
{ | |
var attribute, parts = qualifiedName.split(':'); | |
if (parts.length > 1 && !namespaceURI) { | |
throw new core.DOMException(core.NAMESPACE_ERR, | |
"Prefix specified without namespaceURI (" + qualifiedName + ")"); | |
} | |
ns.validate(qualifiedName, namespaceURI); | |
attribute = this.createAttribute(qualifiedName); | |
attribute.namespaceURI = namespaceURI; | |
attribute.qualifiedName = qualifiedName; | |
attribute._localName = parts.pop(); | |
attribute._prefix = (parts.length > 0) ? parts.pop() : null; | |
return attribute; | |
}; | |
core.Document.prototype.getElementsByTagNameNS = function(/* String */ namespaceURI, | |
/* String */ localName) | |
{ | |
return core.Element.prototype.getElementsByTagNameNS.call(this, | |
namespaceURI, | |
localName); | |
}; | |
defineSetter(core.Element.prototype, "id", function(id) { | |
this.setAttribute("id", id); | |
}); | |
defineGetter(core.Element.prototype, "id", function() { | |
return this.getAttribute("id"); | |
}); | |
core.Document.prototype.getElementById = function(id) { | |
// return the first element | |
return (this._ids && this._ids[id] && this._ids[id].length > 0 ? this._ids[id][0] : null); | |
}; | |
exports.dom = | |
{ | |
level2 : { | |
core : core | |
} | |
}; | |
/***/ }, | |
/* 23 */ | |
/*!********************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/level2/events.js ***! | |
\********************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
/* DOM Level2 Events implemented as described here: | |
* | |
* http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html | |
* | |
*/ | |
var core = __webpack_require__(/*! ./core */ 22).dom.level2.core, | |
utils = __webpack_require__(/*! ../utils */ 3), | |
defineGetter = utils.defineGetter, | |
defineSetter = utils.defineSetter, | |
inheritFrom = utils.inheritFrom; | |
// modify cloned instance for more info check: https://github.com/tmpvar/jsdom/issues/325 | |
core = Object.create(core); | |
var events = {}; | |
events.EventException = function() { | |
if (arguments.length > 0) { | |
this._code = arguments[0]; | |
} else { | |
this._code = 0; | |
} | |
if (arguments.length > 1) { | |
this._message = arguments[1]; | |
} else { | |
this._message = "Unspecified event type"; | |
} | |
Error.call(this, this._message); | |
if (Error.captureStackTrace) { | |
Error.captureStackTrace(this, events.EventException); | |
} | |
}; | |
inheritFrom(Error, events.EventException, { | |
UNSPECIFIED_EVENT_TYPE_ERR : 0, | |
get code() { return this._code;} | |
}); | |
events.Event = function(eventType) { | |
this._eventType = eventType; | |
this._type = null; | |
this._bubbles = null; | |
this._cancelable = null; | |
this._target = null; | |
this._currentTarget = null; | |
this._eventPhase = 0; | |
this._timeStamp = null; | |
this._preventDefault = false; | |
this._stopPropagation = false; | |
}; | |
events.Event.prototype = { | |
initEvent: function(type, bubbles, cancelable) { | |
this._type = type; | |
this._bubbles = bubbles; | |
this._cancelable = cancelable; | |
}, | |
preventDefault: function() { | |
if (this._cancelable) { | |
this._preventDefault = true; | |
} | |
}, | |
stopPropagation: function() { | |
this._stopPropagation = true; | |
}, | |
NONE : 0, | |
CAPTURING_PHASE : 1, | |
AT_TARGET : 2, | |
BUBBLING_PHASE : 3, | |
get eventType() { return this._eventType; }, | |
get type() { return this._type; }, | |
get bubbles() { return this._bubbles; }, | |
get cancelable() { return this._cancelable; }, | |
get target() { return this._target; }, | |
get currentTarget() { return this._currentTarget; }, | |
get eventPhase() { return this._eventPhase; }, | |
get timeStamp() { return this._timeStamp; } | |
}; | |
events.UIEvent = function(eventType) { | |
events.Event.call(this, eventType); | |
this.view = null; | |
this.detail = null; | |
}; | |
inheritFrom(events.Event, events.UIEvent, { | |
initUIEvent: function(type, bubbles, cancelable, view, detail) { | |
this.initEvent(type, bubbles, cancelable); | |
this.view = view; | |
this.detail = detail; | |
}, | |
}); | |
events.MouseEvent = function(eventType) { | |
events.UIEvent.call(this, eventType); | |
this.screenX = null; | |
this.screenY = null; | |
this.clientX = null; | |
this.clientY = null; | |
this.ctrlKey = null; | |
this.shiftKey = null; | |
this.altKey = null; | |
this.metaKey = null; | |
this.button = null; | |
this.relatedTarget = null; | |
}; | |
inheritFrom(events.UIEvent, events.MouseEvent, { | |
initMouseEvent: function(type, | |
bubbles, | |
cancelable, | |
view, | |
detail, | |
screenX, | |
screenY, | |
clientX, | |
clientY, | |
ctrlKey, | |
altKey, | |
shiftKey, | |
metaKey, | |
button, | |
relatedTarget) { | |
this.initUIEvent(type, bubbles, cancelable, view, detail); | |
this.screenX = screenX | |
this.screenY = screenY | |
this.clientX = clientX | |
this.clientY = clientY | |
this.ctrlKey = ctrlKey | |
this.shiftKey = shiftKey | |
this.altKey = altKey | |
this.metaKey = metaKey | |
this.button = button | |
this.relatedTarget = relatedTarget | |
} | |
}); | |
events.MutationEvent = function(eventType) { | |
events.Event.call(this, eventType); | |
this.relatedNode = null; | |
this.prevValue = null; | |
this.newValue = null; | |
this.attrName = null; | |
this.attrChange = null; | |
}; | |
inheritFrom(events.Event, events.MutationEvent, { | |
initMutationEvent: function(type, | |
bubbles, | |
cancelable, | |
relatedNode, | |
prevValue, | |
newValue, | |
attrName, | |
attrChange) { | |
this.initEvent(type, bubbles, cancelable); | |
this.relatedNode = relatedNode; | |
this.prevValue = prevValue; | |
this.newValue = newValue; | |
this.attrName = attrName; | |
this.attrChange = attrChange; | |
}, | |
MODIFICATION : 1, | |
ADDITION : 2, | |
REMOVAL : 3 | |
}); | |
events.EventTarget = function() {}; | |
function getListeners(target, type, capturing) { | |
var listeners = target._listeners | |
&& target._listeners[type] | |
&& target._listeners[type][capturing] || []; | |
if (!capturing) { | |
var traditionalHandler = target['on' + type]; | |
if (traditionalHandler) { | |
var implementation = (target._ownerDocument ? target._ownerDocument.implementation | |
: target.document.implementation); | |
if (implementation.hasFeature('ProcessExternalResources', 'script')) { | |
if (listeners.indexOf(traditionalHandler) < 0) { | |
listeners.push(traditionalHandler); | |
} | |
} | |
} | |
} | |
return listeners; | |
} | |
function dispatchPhase(event, iterator) { | |
var target = iterator(); | |
while (target && !event._stopPropagation) { | |
if (event._eventPhase === event.CAPTURING_PHASE || event._eventPhase === event.AT_TARGET) { | |
callListeners(event, target, getListeners(target, event._type, true)); | |
} | |
if (event._eventPhase === event.AT_TARGET || event._eventPhase === event.BUBBLING_PHASE) { | |
callListeners(event, target, getListeners(target, event._type, false)); | |
} | |
target = iterator(); | |
} | |
} | |
function callListeners(event, target, listeners) { | |
var currentListener = listeners.length; | |
while (currentListener--) { | |
event._currentTarget = target; | |
try { | |
listeners[currentListener].call(target, event); | |
} catch (e) { | |
target.raise( | |
'error', "Dispatching event '" + event._type + "' failed", | |
{error: e, event: event} | |
); | |
} | |
} | |
} | |
function forwardIterator(list) { | |
var i = 0, len = list.length; | |
return function iterator() { return i < len ? list[i++] : null }; | |
} | |
function backwardIterator(list) { | |
var i = list.length; | |
return function iterator() { return i >=0 ? list[--i] : null }; | |
} | |
function singleIterator(obj) { | |
var i = 1; | |
return function iterator() { return i-- ? obj : null }; | |
} | |
events.EventTarget.prototype = { | |
addEventListener: function(type, listener, capturing) { | |
this._listeners = this._listeners || {}; | |
var listeners = this._listeners[type] || {}; | |
capturing = (capturing === true); | |
var capturingListeners = listeners[capturing] || []; | |
for (var i=0; i < capturingListeners.length; i++) { | |
if (capturingListeners[i] === listener) { | |
return; | |
} | |
} | |
capturingListeners.push(listener); | |
listeners[capturing] = capturingListeners; | |
this._listeners[type] = listeners; | |
}, | |
removeEventListener: function(type, listener, capturing) { | |
var listeners = this._listeners && this._listeners[type]; | |
if (!listeners) return; | |
var capturingListeners = listeners[(capturing === true)]; | |
if (!capturingListeners) return; | |
for (var i=0; i < capturingListeners.length; i++) { | |
if (capturingListeners[i] === listener) { | |
capturingListeners.splice(i, 1); | |
return; | |
} | |
} | |
}, | |
dispatchEvent: function(event) { | |
if (event == null) { | |
throw new events.EventException(0, "Null event"); | |
} | |
if (event._type == null || event._type == "") { | |
throw new events.EventException(0, "Uninitialized event"); | |
} | |
var targetList = []; | |
event._target = this; | |
//per the spec we gather the list of targets first to ensure | |
//against dom modifications during actual event dispatch | |
var target = this, | |
targetParent = target._parentNode; | |
while (targetParent) { | |
targetList.push(targetParent); | |
target = targetParent; | |
targetParent = target._parentNode; | |
} | |
targetParent = target._parentWindow; | |
if (targetParent) { | |
targetList.push(targetParent); | |
} | |
var iterator = backwardIterator(targetList); | |
event._eventPhase = event.CAPTURING_PHASE; | |
dispatchPhase(event, iterator); | |
iterator = singleIterator(event._target); | |
event._eventPhase = event.AT_TARGET; | |
dispatchPhase(event, iterator); | |
if (event._bubbles) { | |
iterator = forwardIterator(targetList); | |
event._eventPhase = event.BUBBLING_PHASE; | |
dispatchPhase(event, iterator); | |
} | |
event._currentTarget = null; | |
event._eventPhase = event.NONE; | |
return !event._preventDefault; | |
} | |
}; | |
// Reinherit class heirarchy with EventTarget at its root | |
inheritFrom(events.EventTarget, core.Node, core.Node.prototype); | |
// Node | |
inheritFrom(core.Node, core.Attr, core.Attr.prototype); | |
inheritFrom(core.Node, core.CharacterData, core.CharacterData.prototype); | |
inheritFrom(core.Node, core.Document, core.Document.prototype); | |
inheritFrom(core.Node, core.DocumentFragment, core.DocumentFragment.prototype); | |
inheritFrom(core.Node, core.DocumentType, core.DocumentType.prototype); | |
inheritFrom(core.Node, core.Element, core.Element.prototype); | |
inheritFrom(core.Node, core.Entity, core.Entity.prototype); | |
inheritFrom(core.Node, core.EntityReference, core.EntityReference.prototype); | |
inheritFrom(core.Node, core.Notation, core.Notation.prototype); | |
inheritFrom(core.Node, core.ProcessingInstruction, core.ProcessingInstruction.prototype); | |
// CharacterData | |
inheritFrom(core.CharacterData, core.Text, core.Text.prototype); | |
// Text | |
inheritFrom(core.Text, core.CDATASection, core.CDATASection.prototype); | |
inheritFrom(core.Text, core.Comment, core.Comment.prototype); | |
function getDocument(el) { | |
return el.nodeType == core.Node.DOCUMENT_NODE ? el : el._ownerDocument; | |
} | |
function mutationEventsEnabled(el) { | |
return el.nodeType != core.Node.ATTRIBUTE_NODE && | |
getDocument(el).implementation.hasFeature('MutationEvents'); | |
} | |
utils.intercept(core.Node, 'insertBefore', function(_super, args, newChild, refChild) { | |
var ret = _super.apply(this, args); | |
if (mutationEventsEnabled(this)) { | |
var doc = getDocument(this), | |
ev = doc.createEvent("MutationEvents"); | |
ev.initMutationEvent("DOMNodeInserted", true, false, this, null, null, null, null); | |
newChild.dispatchEvent(ev); | |
if (this.nodeType == core.Node.DOCUMENT_NODE || this._attachedToDocument) { | |
ev = doc.createEvent("MutationEvents"); | |
ev.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null); | |
core.visitTree(newChild, function(el) { | |
if (el.nodeType == core.Node.ELEMENT_NODE) { | |
el.dispatchEvent(ev); | |
el._attachedToDocument = true; | |
} | |
}); | |
} | |
} | |
return ret; | |
}); | |
utils.intercept(core.Node, 'removeChild', function (_super, args, oldChild) { | |
if (mutationEventsEnabled(this)) { | |
var doc = getDocument(this), | |
ev = doc.createEvent("MutationEvents"); | |
ev.initMutationEvent("DOMNodeRemoved", true, false, this, null, null, null, null); | |
oldChild.dispatchEvent(ev); | |
ev = doc.createEvent("MutationEvents"); | |
ev.initMutationEvent("DOMNodeRemovedFromDocument", false, false, null, null, null, null, null); | |
core.visitTree(oldChild, function(el) { | |
if (el.nodeType == core.Node.ELEMENT_NODE) { | |
el.dispatchEvent(ev); | |
el._attachedToDocument = false; | |
} | |
}); | |
} | |
return _super.apply(this, args); | |
}); | |
function dispatchAttrEvent(doc, target, prevVal, newVal, attrName, attrChange) { | |
if (!newVal || newVal != prevVal) { | |
var ev = doc.createEvent("MutationEvents"); | |
ev.initMutationEvent("DOMAttrModified", true, false, target, prevVal, | |
newVal, attrName, attrChange); | |
target.dispatchEvent(ev); | |
} | |
} | |
function attrNodeInterceptor(change) { | |
return function(_super, args, node) { | |
var target = this._parentNode, | |
prev = _super.apply(this, args); | |
if (mutationEventsEnabled(target)) { | |
dispatchAttrEvent(target._ownerDocument, | |
target, | |
prev && prev.value || null, | |
change == 'ADDITION' ? node.value : null, | |
prev && prev.name || node.name, | |
events.MutationEvent.prototype[change]); | |
} | |
return prev; | |
}; | |
} | |
function attrInterceptor(ns) { | |
return function(_super, args, localName, value, _name, _prefix, namespace) { | |
var target = this._parentNode; | |
if (!mutationEventsEnabled(target)) { | |
_super.apply(this, args); | |
return; | |
} | |
if (namespace === undefined) { | |
namespace = null; | |
} | |
var prev = | |
ns ? this.$getNode(namespace, localName) : this.$getNoNS(localName); | |
var prevVal = prev && prev.value || null; | |
_super.apply(this, args); | |
var node = ns ? this.$getNode(namespace, localName): | |
this.$getNoNS(localName); | |
dispatchAttrEvent(target._ownerDocument, | |
target, | |
prevVal, | |
node.value, | |
node.name, | |
events.MutationEvent.prototype.ADDITION); | |
}; | |
} | |
utils.intercept(core.AttributeList, '$removeNode', | |
attrNodeInterceptor('REMOVAL')); | |
utils.intercept(core.AttributeList, '$setNode', | |
attrNodeInterceptor('ADDITION')); | |
utils.intercept(core.AttributeList, '$set', attrInterceptor(true)); | |
utils.intercept(core.AttributeList, '$setNoNS', attrInterceptor(false)); | |
defineGetter(core.CharacterData.prototype, "_nodeValue", function() { | |
return this.__nodeValue; | |
}); | |
defineSetter(core.CharacterData.prototype, "_nodeValue", function(value) { | |
var oldValue = this.__nodeValue; | |
this.__nodeValue = value; | |
if (this._ownerDocument && this._parentNode && mutationEventsEnabled(this)) { | |
var ev = this._ownerDocument.createEvent("MutationEvents") | |
ev.initMutationEvent("DOMCharacterDataModified", true, false, this, oldValue, value, null, null); | |
this.dispatchEvent(ev); | |
} | |
}); | |
core.Document.prototype.createEvent = function(eventType) { | |
switch (eventType) { | |
case "MutationEvents": return new events.MutationEvent(eventType); | |
case "UIEvents": return new events.UIEvent(eventType); | |
case "MouseEvents": return new events.MouseEvent(eventType); | |
case "HTMLEvents": return new events.Event(eventType); | |
} | |
return new events.Event(eventType); | |
}; | |
exports.dom = | |
{ | |
level2 : { | |
core : core, | |
events : events | |
} | |
}; | |
/***/ }, | |
/* 24 */ | |
/*!*******************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/level2/index.js ***! | |
\*******************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
exports.dom = { | |
level2 : { | |
core : __webpack_require__(/*! ./core */ 22).dom.level2.core, | |
events : __webpack_require__(/*! ./events */ 23).dom.level2.events, | |
html : __webpack_require__(/*! ./html */ 5).dom.level2.html | |
} | |
}; | |
/***/ }, | |
/* 25 */ | |
/*!******************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/living/core.js ***! | |
\******************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var core = __webpack_require__(/*! ../level3/core */ 31); | |
__webpack_require__(/*! ./node */ 26); | |
exports.dom = { living: { core: core } }; | |
/***/ }, | |
/* 26 */ | |
/*!******************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/living/node.js ***! | |
\******************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var core = Object.create(__webpack_require__(/*! ../level3/core */ 31).dom.level3.core); | |
var defineGetter = __webpack_require__(/*! ../utils */ 3).defineGetter; | |
var DOCUMENT_POSITION_DISCONNECTED = core.Node.DOCUMENT_POSITION_DISCONNECTED; | |
var DOCUMENT_POSITION_PRECEDING = core.Node.DOCUMENT_POSITION_PRECEDING; | |
var DOCUMENT_POSITION_FOLLOWING = core.Node.DOCUMENT_POSITION_FOLLOWING; | |
var DOCUMENT_POSITION_CONTAINS = core.Node.DOCUMENT_POSITION_CONTAINS; | |
var DOCUMENT_POSITION_CONTAINED_BY = core.Node.DOCUMENT_POSITION_CONTAINED_BY; | |
var DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = core.Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC; | |
/** | |
* Return true if node is of a type obsoleted by the WHATWG living standard | |
* @param {Node} node | |
* @return {Boolean} | |
*/ | |
function isObsoleteNodeType(node) { | |
return node.nodeType === core.Node.ENTITY_NODE || | |
node.nodeType === core.Node.ENTITY_REFERENCE_NODE || | |
node.nodeType === core.Node.NOTATION_NODE || | |
node.nodeType === core.Node.CDATA_SECTION_NODE; | |
} | |
/** | |
* Return the parent node of node, whatever its nodeType is | |
* @param {Node} node | |
* @return {Node or null} | |
*/ | |
function getNodeParent(node) { | |
if(!node) { | |
return node; | |
} | |
switch (node.nodeType) { | |
case core.Node.DOCUMENT_NODE: | |
case core.Node.DOCUMENT_FRAGMENT_NODE: | |
return null; | |
case core.Node.COMMENT_NODE: | |
case core.Node.DOCUMENT_TYPE_NODE: | |
case core.Node.ELEMENT_NODE: | |
case core.Node.PROCESSING_INSTRUCTION_NODE: | |
case core.Node.TEXT_NODE: | |
return node.parentNode; | |
case core.Node.ATTRIBUTE_NODE: | |
return node._parentNode; | |
default: | |
throw new Error('Unknown node type:' + node.nodeType); | |
} | |
} | |
/** | |
* Walk up the node tree and return the nodes root node | |
* @param {Node} node | |
* @return {Node} | |
*/ | |
function findNodeRoot(node) { | |
if (!getNodeParent(node)) { | |
return node; | |
} | |
return findNodeRoot(getNodeParent(node)); | |
} | |
/** | |
* Walk up the node tree returning true if otherNode is an ancestor of node | |
* @param {Node} node | |
* @param {Node} otherNode | |
* @return {Boolean} | |
*/ | |
function isAncestor(node, otherNode) { | |
var parentNode = node.nodeType === node.ATTRIBUTE_NODE ? node._parentNode : node.parentNode; | |
if (!parentNode) { | |
return false; | |
} | |
if(parentNode === otherNode) { | |
return true; | |
} | |
return isAncestor(parentNode, otherNode); | |
} | |
/** | |
* Traverse the node tree starting at current. Return DOCUMENT_POSITION_FOLLOWING if otherNode follows node. Return | |
* DOCUMENT_POSITION_PRECEDING if otherNode precedes node | |
* @param {Node} current | |
* @param {Node} node | |
* @param {Node} otherNode | |
* @return {Number} | |
*/ | |
function followingOrPreceding(current, node, otherNode) { | |
if (current === node) { | |
return core.Node.DOCUMENT_POSITION_FOLLOWING; | |
} | |
if (current === otherNode) { | |
return core.Node.DOCUMENT_POSITION_PRECEDING; | |
} | |
var i = 0, len = current.childNodes.length, child, result; | |
for(; i < len; i += 1) { | |
child = current.childNodes.item(i); | |
if((result = followingOrPreceding(child, node, otherNode)) !== 0) { | |
return result; | |
} | |
} | |
return 0; | |
} | |
/** | |
* Returns a bitmask Number composed of DOCUMENT_POSITION constants based upon the rules defined in | |
* http://dom.spec.whatwg.org/#dom-node-comparedocumentposition | |
* @param {Node} other | |
* @return {Number} | |
*/ | |
core.Node.prototype.compareDocumentPosition = function compareDocumentPosition (other) { | |
// Let reference be the context object. | |
var reference = this; | |
if(!(other instanceof core.Node)) { | |
throw Error("Comparing position against non-Node values is not allowed"); | |
} | |
if (isObsoleteNodeType(reference) || isObsoleteNodeType(other)) { | |
throw new Error('Obsolete Node Type'); | |
} | |
// If other and reference are the same object, return zero. | |
if(reference.isSameNode(other)) { | |
return 0; | |
} | |
// If other and reference are not in the same tree, return the result of adding DOCUMENT_POSITION_DISCONNECTED, | |
// DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, and either DOCUMENT_POSITION_PRECEDING or DOCUMENT_POSITION_FOLLOWING, | |
// with the constraint that this is to be consistent, together. | |
if(findNodeRoot(reference) !== findNodeRoot(other)) { | |
return DOCUMENT_POSITION_DISCONNECTED + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + DOCUMENT_POSITION_FOLLOWING; | |
} | |
// If other is an ancestor of reference, return the result of adding DOCUMENT_POSITION_CONTAINS to | |
// DOCUMENT_POSITION_PRECEDING. | |
if(isAncestor(reference, other)) { | |
return DOCUMENT_POSITION_CONTAINS + DOCUMENT_POSITION_PRECEDING; | |
} | |
// If other is a descendant of reference, return the result of adding DOCUMENT_POSITION_CONTAINED_BY to | |
// DOCUMENT_POSITION_FOLLOWING. | |
if(isAncestor(other, reference)) { | |
return DOCUMENT_POSITION_CONTAINED_BY + DOCUMENT_POSITION_FOLLOWING; | |
} | |
// If other is preceding reference return DOCUMENT_POSITION_PRECEDING, otherwise return DOCUMENT_POSITION_FOLLOWING | |
return followingOrPreceding(findNodeRoot(reference), reference, other); | |
}; | |
/** | |
* The contains(other) method returns true if other is an inclusive descendant of the context object, | |
* and false otherwise (including when other is null). | |
* @param {[Node]} other [the node to test] | |
* @return {[boolean]} [whether other is an inclusive descendant of this] | |
*/ | |
core.Node.prototype.contains = function (other) { | |
return other instanceof core.Node && | |
(this.isSameNode(other) || !!(this.compareDocumentPosition(other) & DOCUMENT_POSITION_CONTAINED_BY)); | |
}; | |
// http://dom.spec.whatwg.org/#dom-node-parentelement | |
defineGetter(core.Node.prototype, "parentElement", function () { | |
return this._parentNode !== null && this._parentNode.nodeType === core.Node.ELEMENT_NODE ? this._parentNode : null; | |
}); | |
/***/ }, | |
/* 27 */ | |
/*!***********************************!*\ | |
!*** (webpack)/buildin/module.js ***! | |
\***********************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
module.exports = function(module) { | |
if(!module.webpackPolyfill) { | |
module.deprecate = function() {}; | |
module.paths = []; | |
// module.parent = undefined by default | |
module.children = []; | |
module.webpackPolyfill = 1; | |
} | |
return module; | |
} | |
/***/ }, | |
/* 28 */ | |
/*!*********************************!*\ | |
!*** ./app/nashorn/nope.coffee ***! | |
\*********************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
/***/ }, | |
/* 29 */ | |
/*!******************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/level1/core.js ***! | |
\******************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
/* | |
ServerJS Javascript DOM Level 1 | |
*/ | |
var inheritFrom = __webpack_require__(/*! ../utils */ 3).inheritFrom; | |
// utility functions | |
var attachId = function(id,elm,doc) { | |
if (id && elm && doc) { | |
if (!doc._ids[id]) { | |
doc._ids[id] = []; | |
} | |
doc._ids[id].push(elm); | |
} | |
}; | |
var detachId = function(id,elm,doc) { | |
var elms, i; | |
if (id && elm && doc) { | |
if (doc._ids && doc._ids[id]) { | |
elms = doc._ids[id]; | |
for (i=0;i<elms.length;i++) { | |
if (elms[i] === elm) { | |
elms.splice(i,1); | |
i--; | |
} | |
} | |
if (elms.length === 0) { | |
delete doc._ids[id]; | |
} | |
} | |
} | |
}; | |
var core = { | |
mapper: function(parent, filter, recursive) { | |
return function() { | |
return core.mapDOMNodes(parent, recursive !== false, filter); | |
}; | |
}, | |
memoizeQuery: function(fn) { | |
var type = core.memoizeQueryType = core.memoizeQueryType || 1; | |
core.memoizeQueryType++; | |
// Only memoize query functions with arity <= 2 | |
if (fn.length > 2) { | |
return fn; | |
} | |
return function() { | |
if (!this._memoizedQueries) { | |
return fn.apply(this, arguments); | |
} | |
if (!this._memoizedQueries[type]) { | |
this._memoizedQueries[type] = {}; | |
} | |
if (arguments.length !== 0 && typeof arguments[0] === 'string' && (arguments.length === 1 || (typeof arguments[1] === 'string' && arguments.length === 2))) { | |
var k = String(arguments[0]); | |
if (arguments.length === 2) { | |
k += '::' + String(arguments[1]); | |
} | |
if (this._memoizedQueries[type].hasOwnProperty(k)) { | |
return this._memoizedQueries[type][k]; | |
} | |
return (this._memoizedQueries[type][k] = fn.apply(this, arguments)); | |
} | |
return fn.apply(this, arguments); | |
} | |
}, | |
// Returns Array | |
mapDOMNodes : function(parent, recursive, callback) { | |
function visit(parent, result) { | |
return Array.prototype.reduce.call(parent.childNodes, reducer, result); | |
} | |
function reducer(array, child) { | |
if (callback(child)) { | |
array.push(child); | |
} | |
if (recursive && child._childNodes) { | |
visit(child, array); | |
} | |
return array; | |
} | |
return visit(parent, []); | |
}, | |
visitTree: function(root, callback) { | |
var cur = root; // TODO: Unroll this. | |
function visit(el) { | |
if (el) { | |
callback(el); | |
if (el._childNodes) { | |
var i = 0, | |
children = el._childNodes, | |
l = children.length; | |
for (i; i<l; i++) { | |
visit(children[i]); | |
} | |
} | |
} | |
} | |
visit(root); | |
}, | |
markTreeReadonly: function(node) { | |
function markLevel(el) { | |
el._readonly = true; | |
// also mark attributes and their children read-only | |
if (el.attributes) { | |
var attributes = el.attributes, l = attributes.length, i=0; | |
attributes._readonly = true; | |
for (i; i<l; i++) { | |
core.visitTree(attributes[i], markLevel); | |
} | |
} | |
} | |
core.visitTree(node, markLevel); | |
} | |
}; | |
// ExceptionCode | |
var INDEX_SIZE_ERR = core.INDEX_SIZE_ERR = 1, | |
DOMSTRING_SIZE_ERR = core.DOMSTRING_SIZE_ERR = 2, | |
HIERARCHY_REQUEST_ERR = core.HIERARCHY_REQUEST_ERR = 3, | |
WRONG_DOCUMENT_ERR = core.WRONG_DOCUMENT_ERR = 4, | |
INVALID_CHARACTER_ERR = core.INVALID_CHARACTER_ERR = 5, | |
NO_DATA_ALLOWED_ERR = core.NO_DATA_ALLOWED_ERR = 6, | |
NO_MODIFICATION_ALLOWED_ERR = core.NO_MODIFICATION_ALLOWED_ERR = 7, | |
NOT_FOUND_ERR = core.NOT_FOUND_ERR = 8, | |
NOT_SUPPORTED_ERR = core.NOT_SUPPORTED_ERR = 9, | |
INUSE_ATTRIBUTE_ERR = core.INUSE_ATTRIBUTE_ERR = 10, | |
// Node Types | |
ELEMENT_NODE = 1, | |
ATTRIBUTE_NODE = 2, | |
TEXT_NODE = 3, | |
CDATA_SECTION_NODE = 4, | |
ENTITY_REFERENCE_NODE = 5, | |
ENTITY_NODE = 6, | |
PROCESSING_INSTRUCTION_NODE = 7, | |
COMMENT_NODE = 8, | |
DOCUMENT_NODE = 9, | |
DOCUMENT_TYPE_NODE = 10, | |
DOCUMENT_FRAGMENT_NODE = 11, | |
NOTATION_NODE = 12; | |
var messages = core.exceptionMessages = { }; | |
messages[INDEX_SIZE_ERR] = "Index size error"; | |
messages[DOMSTRING_SIZE_ERR] = "DOMString size error"; | |
messages[HIERARCHY_REQUEST_ERR] = "Hierarchy request error"; | |
messages[WRONG_DOCUMENT_ERR] = "Wrong document"; | |
messages[INVALID_CHARACTER_ERR] = "Invalid character"; | |
messages[NO_DATA_ALLOWED_ERR] = "No data allowed"; | |
messages[NO_MODIFICATION_ALLOWED_ERR] = "No modification allowed"; | |
messages[NOT_FOUND_ERR] = "Not found"; | |
messages[NOT_SUPPORTED_ERR] = "Not supported"; | |
messages[INUSE_ATTRIBUTE_ERR] = "Attribute in use"; | |
core.DOMException = function(code, message) { | |
this.code = code; | |
Error.call(this, core.exceptionMessages[code]); | |
this.message = core.exceptionMessages[code]; | |
if(message) this.message = this.message + ": " + message; | |
if(Error.captureStackTrace) Error.captureStackTrace(this, core.DOMException); | |
}; | |
core.DOMException.INDEX_SIZE_ERR = INDEX_SIZE_ERR; | |
core.DOMException.DOMSTRING_SIZE_ERR = DOMSTRING_SIZE_ERR; | |
core.DOMException.HIERARCHY_REQUEST_ERR = HIERARCHY_REQUEST_ERR; | |
core.DOMException.WRONG_DOCUMENT_ERR = WRONG_DOCUMENT_ERR; | |
core.DOMException.INVALID_CHARACTER_ERR = INVALID_CHARACTER_ERR; | |
core.DOMException.NO_DATA_ALLOWED_ERR = NO_DATA_ALLOWED_ERR; | |
core.DOMException.NO_MODIFICATION_ALLOWED_ERR = NO_MODIFICATION_ALLOWED_ERR; | |
core.DOMException.NOT_FOUND_ERR = NOT_FOUND_ERR; | |
core.DOMException.NOT_SUPPORTED_ERR = NOT_SUPPORTED_ERR; | |
core.DOMException.INUSE_ATTRIBUTE_ERR = INUSE_ATTRIBUTE_ERR; | |
inheritFrom(Error, core.DOMException, { | |
INDEX_SIZE_ERR : INDEX_SIZE_ERR, | |
DOMSTRING_SIZE_ERR : DOMSTRING_SIZE_ERR, | |
HIERARCHY_REQUEST_ERR : HIERARCHY_REQUEST_ERR, | |
WRONG_DOCUMENT_ERR : WRONG_DOCUMENT_ERR, | |
INVALID_CHARACTER_ERR : INVALID_CHARACTER_ERR, | |
NO_DATA_ALLOWED_ERR : NO_DATA_ALLOWED_ERR, | |
NO_MODIFICATION_ALLOWED_ERR : NO_MODIFICATION_ALLOWED_ERR, | |
NOT_FOUND_ERR : NOT_FOUND_ERR, | |
NOT_SUPPORTED_ERR : NOT_SUPPORTED_ERR, | |
INUSE_ATTRIBUTE_ERR : INUSE_ATTRIBUTE_ERR | |
}); | |
core.NodeList = function NodeList(element, query) { | |
if (!query) { | |
// Non-live NodeList | |
if (Array.isArray(element)) { | |
Array.prototype.push.apply(this, element); | |
} | |
Object.defineProperties(this, { | |
_length: {value: element ? element.length : 0, writable:true} | |
}); | |
} else { | |
Object.defineProperties(this, { | |
_element: {value: element}, | |
_query: {value: query}, | |
_snapshot: {writable: true}, | |
_length: {value: 0, writable: true}, | |
_version: {value: -1, writable: true} | |
}); | |
this._update(); | |
} | |
}; | |
function lengthFromProperties(arrayLike) { | |
var max = -1; | |
for (var i in arrayLike) { | |
var asNumber = +i; | |
if (!isNaN(asNumber) && asNumber > max) { | |
max = asNumber; | |
} | |
} | |
return max + 1; | |
} | |
core.NodeList.prototype = { | |
_update: function() { | |
var i; | |
if (!this._element) { | |
this._length = lengthFromProperties(this); | |
} else { | |
if (this._version < this._element._version) { | |
var nodes = this._snapshot = this._query(); | |
this._resetTo(nodes); | |
this._version = this._element._version; | |
} | |
} | |
}, | |
_resetTo: function(array) { | |
var startingLength = lengthFromProperties(this); | |
for (var i = 0; i < startingLength; ++i) { | |
delete this[i]; | |
} | |
for (var j = 0; j < array.length; ++j) { | |
this[j] = array[j]; | |
} | |
this._length = array.length; | |
}, | |
_toArray: function() { | |
if (this._element) { | |
this._update(); | |
return this._snapshot; | |
} | |
return Array.prototype.slice.call(this); | |
}, | |
get length() { | |
this._update(); | |
return this._length || 0; | |
}, | |
set length(length) { | |
return this._length; | |
}, | |
item: function(index) { | |
this._update(); | |
return this[index] || null; | |
}, | |
toString: function() { | |
return '[ jsdom NodeList ]: contains ' + this.length + ' items'; | |
} | |
}; | |
Object.defineProperty(core.NodeList.prototype, 'constructor', { | |
value: core.NodeList, | |
writable: true, | |
configurable: true | |
}); | |
core.DOMImplementation = function DOMImplementation(document, /* Object */ features) { | |
this._ownerDocument = document; | |
this._features = {}; | |
if (features) { | |
for (var feature in features) { | |
if (features.hasOwnProperty(feature)) { | |
this.addFeature(feature.toLowerCase(), features[feature]); | |
} | |
} | |
} | |
}; | |
core.DOMImplementation.prototype = { | |
get ownerDocument() { return this._ownerDocument }, | |
removeFeature : function(feature, version) { | |
feature = feature.toLowerCase(); | |
if (this._features[feature]) { | |
if (version) { | |
var j = 0, | |
versions = this._features[feature], | |
l = versions.length; | |
for (j; j<l; j++) { | |
if (versions[j] === version) { | |
versions.splice(j,1); | |
return; | |
} | |
} | |
} else { | |
delete this._features[feature]; | |
} | |
} | |
}, | |
addFeature: function(feature, version) { | |
feature = feature.toLowerCase(); | |
if (version) { | |
if (!this._features[feature]) { | |
this._features[feature] = []; | |
} | |
if (version instanceof Array) { | |
Array.prototype.push.apply(this._features[feature], version); | |
} else { | |
this._features[feature].push(version); | |
} | |
} | |
}, | |
hasFeature: function(/* string */ feature, /* string */ version) { | |
feature = (feature) ? feature.toLowerCase() : ''; | |
var versions = (this._features[feature]) ? | |
this._features[feature] : | |
false; | |
if (!version && versions.length && versions.length > 0) { | |
return true; | |
} else if (typeof versions === 'string') { | |
return versions === version; | |
} else if (versions.indexOf && versions.length > 0) { | |
for (var i = 0; i < versions.length; i++) { | |
var found = versions[i] instanceof RegExp ? | |
versions[i].test(version) : | |
versions[i] === version; | |
if (found) { return true; } | |
} | |
return false; | |
} else { | |
return false; | |
} | |
} | |
}; | |
var attrCopy = function(src, dest, fn) { | |
if (src.attributes) { | |
var attrs = src.attributes, i, l = attrs.length, attr, copied; | |
for (i=0;i<l;i++) { | |
attr = attrs[i]; | |
// skip over default attributes | |
if (!attr.specified) { | |
continue; | |
} | |
// TODO: consider duplicating this code and moving it into level2/core | |
if (attr.namespaceURI) { | |
dest.setAttributeNS(attr.namespaceURI, | |
attr.nodeName, | |
attr.nodeValue); | |
var localName = attr.nodeName.split(':').pop(); | |
copied = dest.getAttributeNodeNS(attr.namespaceURI, localName); | |
} else { | |
dest.setAttribute(attr.nodeName, attr.nodeValue); | |
copied = dest.getAttributeNode(attr.nodeName); | |
} | |
if (typeof fn == "function") { | |
fn(attr, copied); | |
} | |
} | |
} | |
return dest; | |
}; | |
core.Node = function Node(ownerDocument) { | |
this._childNodes = new core.NodeList(); | |
this._ownerDocument = ownerDocument; | |
this._attributes = new AttributeList(ownerDocument, this); | |
this._nodeName = null; | |
this._childrenList = null; | |
this._version = 0; | |
this._nodeValue = null; | |
this._parentNode = null; | |
this._nodeName = null; | |
this._memoizedQueries = {}; | |
this._readonly = false; | |
}; | |
core.Node.ELEMENT_NODE = ELEMENT_NODE; | |
core.Node.ATTRIBUTE_NODE = ATTRIBUTE_NODE; | |
core.Node.TEXT_NODE = TEXT_NODE; | |
core.Node.CDATA_SECTION_NODE = CDATA_SECTION_NODE; | |
core.Node.ENTITY_REFERENCE_NODE = ENTITY_REFERENCE_NODE; | |
core.Node.ENTITY_NODE = ENTITY_NODE; | |
core.Node.PROCESSING_INSTRUCTION_NODE = PROCESSING_INSTRUCTION_NODE; | |
core.Node.COMMENT_NODE = COMMENT_NODE; | |
core.Node.DOCUMENT_NODE = DOCUMENT_NODE; | |
core.Node.DOCUMENT_TYPE_NODE = DOCUMENT_TYPE_NODE; | |
core.Node.DOCUMENT_FRAGMENT_NODE = DOCUMENT_FRAGMENT_NODE; | |
core.Node.NOTATION_NODE = NOTATION_NODE; | |
core.Node.prototype = { | |
ELEMENT_NODE : ELEMENT_NODE, | |
ATTRIBUTE_NODE : ATTRIBUTE_NODE, | |
TEXT_NODE : TEXT_NODE, | |
CDATA_SECTION_NODE : CDATA_SECTION_NODE, | |
ENTITY_REFERENCE_NODE : ENTITY_REFERENCE_NODE, | |
ENTITY_NODE : ENTITY_NODE, | |
PROCESSING_INSTRUCTION_NODE : PROCESSING_INSTRUCTION_NODE, | |
COMMENT_NODE : COMMENT_NODE, | |
DOCUMENT_NODE : DOCUMENT_NODE, | |
DOCUMENT_TYPE_NODE : DOCUMENT_TYPE_NODE, | |
DOCUMENT_FRAGMENT_NODE : DOCUMENT_FRAGMENT_NODE, | |
NOTATION_NODE : NOTATION_NODE, | |
get children() { | |
if (!this._childrenList) { | |
var self = this; | |
this._childrenList = new core.NodeList(this, function() { | |
return Array.prototype.filter.call(self._childNodes, function(node) { | |
return node.tagName; | |
}); | |
}); | |
} | |
return this._childrenList; | |
}, | |
get nodeValue() { | |
return this._nodeValue; | |
}, | |
set nodeValue(value) { | |
// readonly | |
if (this._readonly === true) { | |
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR, 'Attempting to modify a read-only node'); | |
} | |
this._nodeValue = value; | |
}, | |
get parentNode() { return this._parentNode;}, | |
get nodeName() { | |
var name = this._nodeName || this._tagName; | |
if (this.nodeType === ELEMENT_NODE && | |
this._ownerDocument && | |
this._ownerDocument._doctype && | |
this._ownerDocument._doctype.name.toLowerCase().indexOf("html") !== -1) | |
{ | |
return name.toUpperCase(); | |
} | |
return name; | |
}, | |
set nodeName(unused) { throw new core.DOMException();}, | |
get attributes() { return this._attributes;}, | |
get firstChild() { | |
return this._childNodes.length > 0 ? this._childNodes[0] : null; | |
}, | |
set firstChild(unused) { throw new core.DOMException();}, | |
get ownerDocument() { return this._ownerDocument;}, | |
get readonly() { return this._readonly;}, | |
get lastChild() { | |
var len = this._childNodes.length; | |
return len > 0 ? this._childNodes[len -1] : null; | |
}, | |
set lastChild(unused) { throw new core.DOMException();}, | |
get childNodes() { | |
return this._childNodes; | |
}, | |
set childNodes(unused) { throw new core.DOMException();}, | |
_indexOf: function(/*Node*/ child) { | |
if (!this._childNodes || | |
!this._childNodes.length) { | |
return -1; | |
} | |
var currentNode, index = 0, children = this._childNodes; | |
while ((currentNode = children[index])) { | |
if (currentNode == child) { | |
break; | |
} | |
index++; | |
} | |
if (currentNode == child) { | |
return index; | |
} | |
return -1; | |
}, | |
get nextSibling() { | |
// find this node's index in the parentNode, add one and call it a day | |
if (!this._parentNode || !this._parentNode._indexOf) { | |
return null; | |
} | |
var index = this._parentNode._indexOf(this); | |
if (index == -1 || index+1 >= this._parentNode._childNodes.length) { | |
return null; | |
} | |
return this._parentNode._childNodes[index+1] || null; | |
}, | |
set nextSibling(unused) { throw new core.DOMException();}, | |
get previousSibling() { | |
if (!this._parentNode || !this._parentNode._indexOf) { | |
return null; | |
} | |
var index = this._parentNode._indexOf(this); | |
if (index == -1 || index-1 < 0) { | |
return null; | |
} | |
return this._parentNode._childNodes[index-1] || null; | |
}, | |
set previousSibling(unused) { throw new core.DOMException();}, | |
/* returns Node */ | |
insertBefore : function(/* Node */ newChild, /* Node*/ refChild) { | |
if (this._readonly === true) { | |
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR, 'Attempting to modify a read-only node'); | |
} | |
// Adopt unowned children, for weird nodes like DocumentType | |
if (!newChild._ownerDocument) newChild._ownerDocument = this._ownerDocument; | |
// TODO - if (!newChild) then? | |
if (newChild._ownerDocument !== this._ownerDocument) { | |
throw new core.DOMException(WRONG_DOCUMENT_ERR); | |
} | |
if (newChild.nodeType && newChild.nodeType === ATTRIBUTE_NODE) { | |
throw new core.DOMException(HIERARCHY_REQUEST_ERR); | |
} | |
// search for parents matching the newChild | |
var current = this; | |
do { | |
if (current === newChild) { | |
throw new core.DOMException(HIERARCHY_REQUEST_ERR); | |
} | |
} while((current = current._parentNode)); | |
// fragments are merged into the element | |
if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) { | |
var tmpNode, i = newChild._childNodes.length; | |
while (i-- > 0) { | |
tmpNode = newChild.removeChild(newChild.firstChild); | |
this.insertBefore(tmpNode, refChild); | |
} | |
} else if (newChild === refChild) { | |
return newChild; | |
} else { | |
// if the newChild is already in the tree elsewhere, remove it first | |
if (newChild._parentNode) { | |
newChild._parentNode.removeChild(newChild); | |
} | |
if (refChild == null) { | |
var refChildIndex = this._childNodes.length; | |
} else { | |
var refChildIndex = this._indexOf(refChild); | |
if (refChildIndex == -1) { | |
throw new core.DOMException(NOT_FOUND_ERR); | |
} | |
} | |
Array.prototype.splice.call(this._childNodes, refChildIndex, 0, newChild); | |
newChild._parentNode = this; | |
if (this._attached && newChild._attach) { | |
newChild._attach(); | |
} | |
this._modified(); | |
} | |
return newChild; | |
}, // raises(DOMException); | |
_modified: function() { | |
this._version++; | |
if (this._ownerDocument) { | |
this._ownerDocument._version++; | |
} | |
if (this._childrenList) { | |
this._childrenList._update(); | |
} | |
this._clearMemoizedQueries() | |
}, | |
_clearMemoizedQueries: function() { | |
this._memoizedQueries = {}; | |
if (this._parentNode && this._parentNode !== this) { | |
this._parentNode._clearMemoizedQueries(); | |
} | |
}, | |
_attrModified: function(name, value, oldValue) { | |
if (name == 'id' && this._attached) { | |
var doc = this._ownerDocument; | |
detachId(oldValue,this,doc); | |
attachId(value,this,doc); | |
} | |
// Check for inline event handlers. | |
// We can't set these like other attributes then look it up in | |
// dispatchEvent() because that would create 2 'traditional' event handlers | |
// in the case where there's an inline event handler attribute, plus one | |
// set using element.on* in a script. | |
// | |
// @see http://www.w3.org/TR/2011/WD-html5-20110405/webappapis.html#event-handler-content-attributes | |
if ((name.length > 2) && (name[0] == 'o') && (name[1] == 'n')) { | |
if (value) { | |
var self = this; | |
// Check whether we're the window. This can happen because inline | |
// handlers on the body are proxied to the window. | |
var w = (typeof self.run !== 'undefined') ? self : self._ownerDocument.parentWindow; | |
self[name] = function (event) { | |
// The handler code probably refers to functions declared in the | |
// window context, so we need to call run(). | |
// Use awesome hacks to get the correct `this` context for the | |
// inline event handler. This would only be necessary if we're an | |
// element, but for the sake of simplicity we also do it on window. | |
// Also set event variable and support `return false`. | |
w.__tempContextForInlineEventHandler = self; | |
w.__tempEvent = event; | |
w.run("if ((function (event) {" + value + "}).call(" + | |
"window.__tempContextForInlineEventHandler, window.__tempEvent) === false) {" + | |
"window.__tempEvent.preventDefault()}"); | |
delete w.__tempContextForInlineEventHandler; | |
delete w.__tempEvent; | |
}; | |
} else { | |
this[name] = null; | |
} | |
} | |
}, | |
/* returns Node */ | |
replaceChild : function(/* Node */ newChild, /* Node */ oldChild){ | |
this.insertBefore(newChild, oldChild); | |
return this.removeChild(oldChild); | |
}, //raises(DOMException); | |
/* returns void */ | |
_attach : function() { | |
this._attached = true; | |
if (this.id) { | |
attachId(this.id,this,this._ownerDocument); | |
} | |
for (var i=0,len=this._childNodes.length;i<len;i++) { | |
if (this._childNodes[i]._attach) { | |
this._childNodes[i]._attach(); | |
} | |
} | |
}, | |
/* returns void */ | |
_detach : function() { | |
var i, elms; | |
this._attached = false; | |
if (this.id) { | |
detachId(this.id,this,this._ownerDocument); | |
} | |
for (var i=0,len=this._childNodes.length;i<len;i++) { | |
this._childNodes[i]._detach(); | |
} | |
}, | |
/* returns Node */ | |
removeChild : function(/* Node */ oldChild){ | |
if (this._readonly === true) { | |
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR); | |
} | |
// TODO - if (!oldChild) then? | |
var oldChildIndex = this._indexOf(oldChild); | |
if (oldChildIndex == -1) { | |
throw new core.DOMException(NOT_FOUND_ERR); | |
} | |
Array.prototype.splice.call(this._childNodes, oldChildIndex, 1); | |
oldChild._parentNode = null; | |
this._modified(); | |
oldChild._detach(); | |
return oldChild; | |
}, // raises(DOMException); | |
/* returns Node */ | |
appendChild : function(/* Node */ newChild) { | |
return this.insertBefore(newChild, null); | |
}, // raises(DOMException); | |
/* returns boolean */ | |
hasChildNodes : function() { | |
return this._childNodes.length > 0; | |
}, | |
/* returns Node */ | |
cloneNode : function(/* bool */ deep, fn) { | |
var object = null; | |
switch (this.nodeType) { | |
case this.ELEMENT_NODE: | |
object = attrCopy(this,this._ownerDocument.createElement(this.tagName), fn); | |
break; | |
case this.TEXT_NODE: | |
object = attrCopy(this,this._ownerDocument.createTextNode(this.tagName)); | |
object.nodeValue = this.nodeValue; | |
break; | |
case this.CDATA_SECTION_NODE: | |
object = this._ownerDocument.createCDATASection(this.tagName); | |
object.nodeValue = this.nodeValue; | |
break; | |
case this.ENTITY_REFERENCE_NODE: | |
var name = (this._entity) ? this._entity.name : this._entityName, | |
ref = this._ownerDocument.createEntityReference(name); | |
object = attrCopy(this, ref); | |
object.nodeValue = this.nodeValue; | |
break; | |
case this.ATTRIBUTE_NODE: | |
object = this._ownerDocument.createAttribute(this.name); | |
break; | |
case this.ENTITY_NODE: | |
var entity = this._ownerDocument.createEntityNode(this.name); | |
object = attrCopy(this, entity); | |
object.nodeValue = this.nodeValue; | |
object._publicId = this._publicId; | |
object._systemId = this._systemId; | |
object._notationName = this.notationName; | |
break; | |
case this.PROCESSING_INSTRUCTION_NODE: | |
var pi = this._ownerDocument.createProcessingInstruction(this._target, | |
this._data); | |
object = attrCopy(this, pi); | |
object.nodeValue = this.nodeValue; | |
break; | |
case this.COMMENT_NODE: | |
object = this._ownerDocument.createComment(this.tagName); | |
object.nodeValue = this.nodeValue; | |
break; | |
case this.DOCUMENT_NODE: | |
object = attrCopy(this, new core.Document()); | |
// TODO: clone the doctype/entities/notations/etc? | |
break; | |
case this.DOCUMENT_TYPE_NODE: | |
object = attrCopy(this, new core.DocumentType()); | |
object.nodeValue = this.nodeValue; | |
break; | |
case this.DOCUMENT_FRAGMENT_NODE: | |
object = this._ownerDocument.createDocumentFragment(); | |
break; | |
case this.NOTATION_NODE: | |
object = this._ownerDocument.createNotationNode(this._name, | |
this._publicId, | |
this._systemId); | |
object = attrCopy(this,object); | |
object.nodeValue = this.nodeValue; | |
break; | |
default: | |
throw new core.DOMException(NOT_FOUND_ERR); | |
break; | |
} | |
if (typeof fn === "function") { | |
fn(this, object); | |
} | |
if (deep || this.nodeType === ATTRIBUTE_NODE) { | |
var clone = null; | |
for (var i=0,len=this._childNodes.length;i<len;i++) | |
{ | |
clone = this._childNodes[i].cloneNode(true); | |
if (clone.nodeType === ATTRIBUTE_NODE) { | |
object.setAttributeNode(clone); | |
} else { | |
var readonly = object._readonly; | |
object._readonly = false; | |
object.appendChild(clone); | |
object._readonly = readonly; | |
} | |
} | |
} | |
return object; | |
}, | |
/* returns void */ | |
normalize: function() { | |
var prevChild, child, attr,i; | |
if (this._attributes && this._attributes.length) { | |
for (i=0;i<this._attributes.length;i++) | |
{ | |
if (this._attributes[i]) { | |
attr = this._attributes[i].normalize(); | |
} | |
} | |
} | |
for (i=0;i<this._childNodes.length;i++) | |
{ | |
child = this._childNodes[i]; | |
if (child.normalize) { | |
child.normalize(); | |
} | |
// Level2/core clean off empty nodes | |
if (child.nodeValue === "") { | |
this.removeChild(child); | |
i--; | |
continue; | |
} | |
if (i>0) { | |
prevChild = this._childNodes[i-1]; | |
if (child.nodeType === TEXT_NODE && | |
prevChild.nodeType === TEXT_NODE) | |
{ | |
// remove the child and decrement i | |
prevChild.appendData(child.nodeValue); | |
this.removeChild(child); | |
i--; | |
} | |
} | |
} | |
}, | |
toString: function() { | |
var id = ''; | |
if (this.id) { | |
id = '#' + this.id; | |
} | |
if (this.className) { | |
var classes = this.className.split(/\s+/); | |
for (var i = 0, len = classes.length; i < len; i++) { | |
id += '.' + classes[i]; | |
} | |
} | |
return '[ ' + this.tagName + id + ' ]'; | |
}, | |
raise: function(type, message, data) { | |
var text = type + ": " + message; | |
if (data) { | |
if (data.exception) { | |
text = data.exception.stack; | |
} else { | |
text += ' - More:\n' + data; | |
} | |
} | |
if (type === "error") { | |
if (!this.errors) { | |
this.errors = []; | |
} | |
// TODO: consider using actual `Error` objects or `DOMException`s even.. | |
var err = { | |
type : type, | |
message : message || "No message", | |
data : data || null | |
}; | |
this.errors.push(err); | |
if (this._ownerDocument && | |
this._ownerDocument.raise && | |
this !== this._ownerDocument) | |
{ | |
this._ownerDocument.raise(type, message, data); | |
} | |
} | |
} | |
}; | |
core.NamedNodeMap = function NamedNodeMap(document) { | |
this._nodes = Object.create(null); | |
this._nsStore = {}; | |
this.length = 0; | |
this._ownerDocument = document; | |
this._readonly = false; | |
}; | |
core.NamedNodeMap.prototype = { | |
get readonly() { return this._readonly;}, | |
get ownerDocument() { this._ownerDocument;}, | |
exists : function(name) { | |
return (this._nodes[name] || this._nodes[name] === null) ? true : false; | |
}, | |
/* returns Node */ | |
getNamedItem: function(/* string */ name) { | |
return this._nodes[name] || null; | |
}, | |
/* returns Node */ | |
setNamedItem: function(/* Node */ arg) { | |
// readonly | |
if (this._readonly === true) { | |
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR); | |
} | |
// arg is from a different document | |
if (arg && arg._ownerDocument !== this._ownerDocument) { | |
throw new core.DOMException(WRONG_DOCUMENT_ERR); | |
} | |
// if this argument is already in use.. | |
if (arg && arg._ownerElement) { | |
throw new core.DOMException(INUSE_ATTRIBUTE_ERR); | |
} | |
var name = arg.name || arg.tagName; | |
var ret = this._nodes[name]; | |
if (!ret) { | |
this.length++; | |
ret = null; | |
} | |
arg._specified = true; | |
this._nodes[name] = arg; | |
// Avoid overwriting prototype methods etc.: | |
if (this.hasOwnProperty(name) || !(name in this)) { | |
this[name] = arg; | |
} | |
return ret; | |
}, // raises: function(DOMException) {}, | |
/* returns Node */ | |
removeNamedItem: function(/* string */ name) { | |
// readonly | |
if (this._readonly === true) { | |
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR); | |
} | |
if (!this._nodes[name]) { | |
throw new core.DOMException(NOT_FOUND_ERR); | |
} | |
var prev = this._nodes[name] || null; | |
delete this._nodes[name]; | |
delete this[name]; | |
this.length--; | |
return prev; | |
}, // raises: function(DOMException) {}, | |
/* returns Node */ | |
item: function(/* int */ index) { | |
var current = 0; | |
for (var member in this._nodes) { | |
if (current === index && this._nodes[member]) { | |
return this._nodes[member]; | |
} | |
current++; | |
} | |
return null; | |
} | |
}; | |
// | |
// For historical reasons, AttributeList objects must allow accessing | |
// attributes as if the object were an associative array. For | |
// instance, if `attributes` is an AttributeList object then | |
// `attributes.x` should evaluate to the attribute named `x` (which is | |
// not in any namespace). The AttributeList class uses the dollar | |
// symbol ($) to reduce the possibility of a clash between its field | |
// names and possible attribute names. For instance, if the method | |
// currently named `$set` were instead named `set` then it would not | |
// be possible to access an attribute named `set` through | |
// `attributes.set`. The dollar symbol is not valid in attribute names | |
// so `$set` cannot clash. | |
// | |
// Some fields do not get the $ because: | |
// | |
// * They are part of the API (e.g. `setNamedItem`, `length`), so they | |
// must be visible under a specific name. | |
// | |
// * Jsdom's code which traverses the DOM tree expects regularly named | |
// fields (e.g. `_parentNode`). | |
// | |
function AttributeList(document, parentNode) { | |
this._ownerDocument = document; | |
this._parentNode = parentNode; | |
this._readonly = false; | |
this._$ns_to_attrs = Object.create(null); | |
this._$name_to_attrs = Object.create(null); | |
this.length = 0; | |
} | |
AttributeList.prototype = { | |
_$reserved: [], // Initialized later | |
// | |
// Code internal to jsdom and which manipulates an AttributeList | |
// object should use the following methods rather than the methods | |
// that provide the NamedNodeMap interface. | |
// | |
// This method *ignores* namespaces. This is *not* the same thing as | |
// requesting an attribute with a null namespace. | |
$getNoNS: function (name) { | |
var attrs = this._$name_to_attrs[name]; | |
if (!attrs) { | |
return null; | |
} | |
return attrs[0] || null; | |
}, | |
$getNode: function (namespace, localName) { | |
var attrs = this._$ns_to_attrs[namespace]; | |
if (!attrs) { | |
return null; | |
} | |
var ret = attrs[localName]; | |
if (!ret) { | |
return null; | |
} | |
return ret; | |
}, | |
// This method *ignores* namespaces. This is *not* the same thing as | |
// requesting an attribute with a null namespace. | |
$setNoNS: function (name, value) { | |
var attr = this.$getNoNS(name); | |
if (!attr) { | |
this.$set(name, value); | |
return; | |
} | |
var prev_val = attr.value; | |
attr.value = value; | |
attr._specified = true; | |
this._parentNode._attrModified(attr.name, attr.value, prev_val); | |
this._parentNode._modified(); | |
}, | |
$set: function (localName, value, name, prefix, namespace) { | |
if (this._readonly) { | |
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR); | |
} | |
if (name === undefined) { | |
name = localName; | |
} | |
if (prefix === undefined) { | |
prefix = null; | |
} | |
if (namespace === undefined) { | |
namespace = null; | |
} | |
var prev_attr = this.$getNode(namespace, localName); | |
var attr; | |
var prev_val = null; | |
if (prev_attr) { | |
prev_val = prev_attr.value; | |
prev_attr._prefix = prefix; | |
prev_attr.value = value; | |
attr = prev_attr; | |
attr._specified = true; | |
this._parentNode._attrModified(attr.name, attr.value, prev_val); | |
this._parentNode._modified(); | |
} | |
else { | |
attr = this._ownerDocument.createAttribute(name); | |
attr._ownerElement = this._parentNode; | |
attr.value = value; | |
attr._namespaceURI = namespace; | |
attr._prefix = prefix; | |
attr._localName = localName; | |
attr._parentNode = this._parentNode; | |
attr._created = true; | |
this.$setNode(attr); | |
// $setNode calls the parent node methods. | |
} | |
}, | |
$setNode: function (attr) { | |
if (this._readonly) { | |
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR); | |
} | |
if (attr.nodeType !== ATTRIBUTE_NODE) { | |
throw new core.DOMException(HIERARCHY_REQUEST_ERR); | |
} | |
if (attr._ownerDocument !== this._ownerDocument) { | |
throw new core.DOMException(WRONG_DOCUMENT_ERR); | |
} | |
if (attr._parentNode && attr._parentNode !== this._parentNode) { | |
throw new core.DOMException(INUSE_ATTRIBUTE_ERR); | |
} | |
var localName = attr._localName; | |
var name = attr.name; | |
var prefix = attr._prefix; | |
var namespace = attr._namespaceURI; | |
if (name === undefined) { | |
name = localName; | |
} | |
if (prefix === undefined) { | |
prefix = null; | |
} | |
if (namespace === undefined) { | |
namespace = null; | |
} | |
var prev_attr = this.$getNode(namespace, localName); | |
var prev_val = null; | |
if (prev_attr) { | |
prev_val = prev_attr.value; | |
// Remove the old attribute | |
this._$onlyRemoveNode(prev_attr); | |
} | |
attr._parentNode = this._parentNode; | |
attr._ownerElement = this._parentNode; | |
attr._specified = true; | |
var attrs = this._$ns_to_attrs[namespace]; | |
if (!attrs) { | |
attrs = this._$ns_to_attrs[namespace] = Object.create(null); | |
} | |
attrs[localName] = attr; | |
attrs = this._$name_to_attrs[name]; | |
if (!attrs) { | |
attrs = this._$name_to_attrs[name] = [attr]; | |
} | |
else { | |
attrs.push(attr); | |
} | |
// Only attributes in the null namespace can be set this way. | |
if (namespace === null) { | |
// Make the node a field on this object but ONLY if it does not | |
// clash with the reserved names. | |
if (this._$reserved.indexOf(name) === -1) { | |
this[name] = attr; | |
} | |
} | |
this[this.length] = attr; | |
this.length++; | |
this._parentNode._attrModified(attr.name, attr.value, prev_val); | |
this._parentNode._modified(); | |
return prev_attr; | |
}, | |
// This method *ignores* namespaces. This is *not* the same thing as | |
// requesting an attribute with a null namespace. | |
$removeNoNS: function (name) { | |
var attr = this.$getNoNS(name); | |
return attr ? this.$removeNode(attr) : null; | |
}, | |
$remove: function (namespace, localName) { | |
var attr = this.$getNode(namespace, localName); | |
return attr ? this.$removeNode(attr) : null; | |
}, | |
/* Only removes the node, and does not add a default value. */ | |
_$onlyRemoveNode: function (attr) { | |
var namespace = attr._namespaceURI; | |
var localName = attr._localName; | |
var attrs = this._$ns_to_attrs[namespace]; | |
if (!attrs) { | |
return null; | |
} | |
var found_attr = attrs[localName]; | |
if (found_attr !== attr) { | |
return null; | |
} | |
if (this._readonly) { | |
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR); | |
} | |
attr._ownerElement = null; | |
attr._parentNode = null; | |
delete attrs[localName]; | |
attrs = this._$name_to_attrs[attr.name]; | |
attrs.splice(attrs.indexOf(attr), 1); | |
var ix = Array.prototype.indexOf.call(this, attr); | |
// Splice also modifies length. | |
Array.prototype.splice.call(this, ix, 1); | |
if (this[attr.name] === attr) { | |
delete this[attr.name]; | |
} | |
this._parentNode._attrModified(attr.name); | |
this._parentNode._modified(); | |
return attr; | |
}, | |
$removeNode: function (attr) { | |
if (!this._$onlyRemoveNode(attr)) { | |
return null; | |
} | |
// set default value if available | |
var doc = this._ownerDocument; | |
if (doc && doc._doctype && doc._doctype.name.toLowerCase() !== "html") { | |
var elem = | |
doc._doctype._attributes.getNamedItem(this._parentNode.nodeName); | |
if (elem) { | |
var defaultValue = elem.attributes.getNamedItemNS(attr._namespaceURI, | |
attr._localName); | |
if (defaultValue) { | |
this.$set(attr._localName, defaultValue.value, attr.name, attr._prefix, | |
attr._namespaceURI); | |
var new_attr = this.$getNode(attr._namespaceURI, attr._localName); | |
new_attr._specified = false; | |
} | |
} | |
} | |
return attr; | |
}, | |
// Although http://dom.spec.whatwg.org/#concept-element-attribute | |
// does not specify that the attributes field on an Element should | |
// support NamedNodeMap, in practice browsers still support this | |
// interface so we should support it for compatibility. | |
getNamedItem: function (name) { | |
return this.getNamedItemNS(null, name); | |
}, | |
removeNamedItem: function (name) { | |
return this.removeNamedItemNS(null, name); | |
}, | |
item: function (i) { | |
return this[i]; | |
}, | |
getNamedItemNS: function (namespaceURI, localName) { | |
if (namespaceURI === "") { | |
namespaceURI = null; | |
} | |
return this.$getNode(namespaceURI, localName); | |
}, | |
removeNamedItemNS: function (namespaceURI, localName) { | |
var ret = this.$remove(namespaceURI, localName); | |
if (ret === null) { | |
throw new core.DOMException(NOT_FOUND_ERR); | |
} | |
return ret; | |
} | |
}; | |
// Alias these methods. | |
AttributeList.prototype.setNamedItem = AttributeList.prototype.$setNode; | |
AttributeList.prototype.setNamedItemNS = AttributeList.prototype.$setNode; | |
(function () { | |
// Construct the list of reserved attribute names from a temporarily | |
// created AttributeList and from the chain of prototypes. We need | |
// this because JavaScript code running an a browser expects to be | |
// able to do el.attributes.x to get the value of the attribute "x" | |
// on an element. Unfortunately, JavaScript *currently* does not | |
// allow us to elegantly provide such functionality without risking | |
// a clash with the fields and methods set on the AttributeList | |
// object. Hence we need a list of reserved field names. | |
var reserved = Object.keys(new AttributeList()); | |
var prototype = AttributeList.prototype; | |
while (prototype) { | |
reserved = reserved.concat(Object.getOwnPropertyNames(prototype)); | |
prototype = Object.getPrototypeOf(prototype); | |
} | |
AttributeList.prototype._$reserved = reserved; | |
})(); | |
core.AttributeList = AttributeList; | |
core.NotationNodeMap = function NotationNodeMap(document) { | |
core.NamedNodeMap.call(this, document); | |
this._readonly = false; | |
for (var i=1;i<arguments.length;i++) { | |
this.setNamedItem(arguments[i]); | |
} | |
this._readonly = true; | |
}; | |
inheritFrom(core.NamedNodeMap, core.NotationNodeMap); | |
core.EntityNodeMap = function EntityNodeMap(document) { | |
core.NamedNodeMap.call(this,document); | |
this._readonly = false; | |
var i = 1, l = arguments.length; | |
for (i=1; i<l; i++) { | |
this.setNamedItem(arguments[i]); | |
} | |
core.markTreeReadonly(this); | |
}; | |
inheritFrom(core.NamedNodeMap, core.EntityNodeMap); | |
core.Element = function Element(document, tagName) { | |
this._ownerDocument = document; | |
core.Node.call(this, document); | |
this._nodeName = tagName; | |
this._tagName = tagName; | |
}; | |
inheritFrom(core.Node, core.Element, { | |
get nodeValue() { return null;}, | |
set nodeValue(value) { /* do nothing */ }, | |
get tagName() { | |
if (this.nodeType === ELEMENT_NODE && | |
this._ownerDocument && | |
this._ownerDocument._doctype && | |
this._ownerDocument._doctype.name.toLowerCase().indexOf("html") !== -1) | |
{ | |
return this.nodeName.toUpperCase(); | |
} | |
return this.nodeName; | |
}, | |
nodeType : ELEMENT_NODE, | |
get attributes() { | |
return this._attributes; | |
}, | |
/* returns string */ | |
getAttribute: function(/* string */ name) { | |
var attribute = this._attributes.$getNode(null, name); | |
if (attribute) { | |
return attribute.value; | |
} | |
return null; | |
}, | |
setAttribute: function(/* string */ name, /* string */ value) { | |
if (this._ownerDocument) { | |
var attr = this._ownerDocument.createAttribute(name); | |
attr.value = value; | |
attr._ownerElement = this; | |
attr._created = true; | |
this._attributes.$setNode(attr); | |
} | |
}, //raises: function(DOMException) {}, | |
removeAttribute: function(/* string */ name) { | |
this._attributes.$remove(null, name); | |
}, // raises: function(DOMException) {}, | |
/* returns Attr */ | |
getAttributeNode: function(/* string */ name) { | |
return this._attributes.$getNode(null, name); | |
}, | |
/* returns Attr */ | |
setAttributeNode: function(/* Attr */ newAttr) { | |
var prevNode = this._attributes.$getNode(null, newAttr.name); | |
if (prevNode) { | |
prevNode._ownerElement = null; | |
} | |
newAttr._ownerElement = this; | |
this._attributes.$setNode(newAttr); | |
return (prevNode && prevNode.specified) ? prevNode : null; | |
}, // raises: function(DOMException) {}, | |
/* returns Attr */ | |
removeAttributeNode: function(/* Attr */ oldAttr) { | |
var ret = this._attributes.$removeNode(oldAttr); | |
if (ret !== null) { | |
return ret; | |
} | |
throw new core.DOMException(NOT_FOUND_ERR); | |
}, //raises: function(DOMException) {}, | |
/* returns NodeList */ | |
getElementsByTagName: core.memoizeQuery(function(/* string */ name) { | |
name = name.toLowerCase(); | |
function filterByTagName(child) { | |
child = (child.nodeType === ENTITY_REFERENCE_NODE) ? | |
child._entity : | |
child; | |
if (child.nodeName && child.nodeType === ELEMENT_NODE) { | |
return name === "*" || (child.nodeName.toLowerCase() === name); | |
} | |
return false; | |
} | |
return new core.NodeList(this._ownerDocument || this, core.mapper(this, filterByTagName, true)); | |
}), | |
}); | |
core.DocumentFragment = function DocumentFragment(document) { | |
core.Node.call(this, document); | |
this._nodeName = this._tagName = "#document-fragment"; | |
}; | |
inheritFrom(core.Node, core.DocumentFragment, { | |
nodeType : DOCUMENT_FRAGMENT_NODE, | |
get nodeValue() { return null;}, | |
set nodeValue(unused) { /* do nothing */ }, | |
get attributes() { return null;} | |
}); | |
core.ProcessingInstruction = function ProcessingInstruction(document, target, data) { | |
this._ownerDocument = document; | |
core.Node.call(this, document); | |
this._nodeName = target; | |
this._tagName = target; | |
this._target = target; | |
this._nodeValue = data; | |
} | |
inheritFrom(core.Node, core.ProcessingInstruction, { | |
nodeType : PROCESSING_INSTRUCTION_NODE, | |
get target() { return this._target;}, | |
set target(value) { throw new core.DOMException(1);}, | |
get nodeValue() { return this._nodeValue;}, | |
set nodeValue(value) { this._nodeValue = value}, | |
get data() { return this._nodeValue;}, | |
set data(unused) { throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR);}, | |
get attributes() { return null;} | |
}); | |
core.Document = function Document(options) { | |
if (!options) { | |
options = {}; | |
} | |
else if (typeof options == 'string') { | |
options = { | |
name: options | |
}; | |
} | |
core.Node.call(this, "#document"); | |
this._nodeName = this._tagName = "#document"; | |
this._contentType = options.contentType || "text/xml"; | |
this._doctype = options._doctype; | |
this._implementation = options.implementation || new (core.DOMImplementation)(); | |
this._documentElement = null; | |
this._ids = Object.create(null); | |
this._attached = true; | |
this._ownerDocument = this; | |
this._readonly = false; | |
}; | |
var tagRegEx = /[^\w:\d_\.-]+/i; | |
var entRegEx = /[^\w\d_\-&;]+/; | |
var invalidAttrRegEx = /[\s"'>/=\u0000-\u001A]/; | |
inheritFrom(core.Node, core.Document, { | |
nodeType : DOCUMENT_NODE, | |
_elementBuilders : { }, | |
_defaultElementBuilder: function(document, tagName) { | |
return new core.Element(document, tagName); | |
}, | |
get contentType() { return this._contentType;}, | |
get doctype() { return this._doctype || null;}, | |
set doctype(doctype) { this._doctype = doctype;}, | |
get documentElement() { | |
if (this._documentElement) { | |
return this._documentElement; | |
} else { | |
var children = this._childNodes, len = this._childNodes.length, i=0; | |
for (i;i<len;i++) { | |
if (children[i].nodeType === ELEMENT_NODE) { | |
this._documentElement = children[i]; | |
return children[i]; | |
} | |
} | |
return null; | |
} | |
}, | |
get implementation() { return this._implementation;}, | |
set implementation(implementation) { this._implementation = implementation;}, | |
get nodeName() { return '#document'; }, | |
get tagName() { | |
return null; | |
}, | |
get nodeValue() { return null; }, | |
set nodeValue(unused) { /* noop */ }, | |
get attributes() { return null;}, | |
get ownerDocument() { return null;}, | |
get readonly() { return this._readonly;}, | |
/* returns Element */ | |
_createElementNoTagNameValidation: function(/*string*/ tagName) { | |
var lower = tagName.toLowerCase(); | |
var element = (this._elementBuilders[lower] || this._defaultElementBuilder)(this, tagName); | |
// Check for and introduce default elements | |
if (this._doctype && this._doctype._attributes && this._doctype.name.toLowerCase() !== "html") { | |
var attrElement = this._doctype._attributes.getNamedItem(tagName); | |
if (attrElement && attrElement._childNodes) { | |
var attrs = attrElement.attributes; | |
var attr, len = attrs.length, defaultAttr; | |
for (var i = 0; i < len; i++) { | |
defaultAttr = attrs[i]; | |
if (defaultAttr) { | |
attr = this.createAttribute(defaultAttr.name); | |
attr.value = defaultAttr.value; | |
element.setAttributeNode(attr); | |
attr._specified = false; | |
attr._created = true; | |
} | |
} | |
} | |
} | |
if (!element.namespaceURI) element._namespaceURI = "http://www.w3.org/1999/xhtml"; | |
element._created = true; | |
return element; | |
}, | |
/* returns Element */ | |
createElement: function(/* string */ tagName) { | |
tagName = String(tagName); | |
var c = []; | |
if (tagName.length === 0 || (c = tagName.match(tagRegEx))) { | |
throw new core.DOMException(INVALID_CHARACTER_ERR, 'Invalid character in tag name: ' + c.pop()); | |
} | |
return this._createElementNoTagNameValidation(tagName); | |
}, //raises: function(DOMException) {}, | |
/* returns DocumentFragment */ | |
createDocumentFragment: function() { | |
return new core.DocumentFragment(this); | |
}, | |
/* returns Text */ | |
createTextNode: function(/* string */ data) { | |
return new core.Text(this,data); | |
}, | |
/* returns Comment */ | |
createComment: function(/* string */ data) { | |
return new core.Comment(this,data); | |
}, | |
/* returns CDATASection */ | |
createCDATASection: function(/* string */ data) { | |
if (this._doctype && this._doctype.name === "html") { | |
throw new core.DOMException(NOT_SUPPORTED_ERR); | |
} | |
return new core.CDATASection(this,data); | |
}, // raises: function(DOMException) {}, | |
/* returns ProcessingInstruction */ | |
createProcessingInstruction: function(/* string */ target,/* string */ data) { | |
if (target.match(tagRegEx) || !target || !target.length) { | |
throw new core.DOMException(INVALID_CHARACTER_ERR); | |
} | |
return new core.ProcessingInstruction(this, target, data); | |
}, // raises: function(DOMException) {}, | |
/* returns Attr */ | |
createAttribute: function(/* string */ name) { | |
if (!name || !name.length || name.match(invalidAttrRegEx) ) { | |
throw new core.DOMException(INVALID_CHARACTER_ERR, "attribute name: " + name); | |
} | |
return new core.Attr(this, name,false); | |
}, // raises: function(DOMException) {}, | |
/* returns EntityReference */ | |
createEntityReference: function(/* string */ name) { | |
if (this._doctype && this._doctype.name === "html") { | |
throw new core.DOMException(NOT_SUPPORTED_ERR); | |
} | |
name = name.replace(/[&;]/g,""); | |
if (!name || !name.length) { | |
throw new core.DOMException(INVALID_CHARACTER_ERR); | |
} | |
if (name.match(tagRegEx)) { | |
throw new core.DOMException(INVALID_CHARACTER_ERR); | |
} | |
var entity; | |
if (this._doctype && this._doctype.entities) { | |
entity = this._doctype.entities.getNamedItem(name); | |
} else { | |
entity = null; | |
} | |
var ref = new core.EntityReference(this, entity); | |
ref._entityName = name; | |
return ref; | |
}, //raises: function(DOMException) {}, | |
/* returns Entity */ | |
createEntityNode : function(/* string */ name) | |
{ | |
if (name.match(entRegEx) || !name || !name.length) { | |
throw new core.DOMException(INVALID_CHARACTER_ERR); | |
} | |
var ret = new core.Entity(this, name); | |
ret._readonly = false;// TODO: fix me please. | |
for (var i=1;i<arguments.length;i++) | |
{ | |
ret.appendChild(arguments[i]); | |
} | |
core.markTreeReadonly(ret); | |
return ret; | |
}, | |
/* returns Notation */ | |
createNotationNode : function(/* string */ name,/* string */ publicId,/* string */ systemId) | |
{ | |
if (name.match(entRegEx) || !name || !name.length) { | |
throw new core.DOMException(INVALID_CHARACTER_ERR); | |
} | |
var ret = new core.Notation(this, name, publicId, systemId); | |
ret._readonly = false;// TODO: fix me please. | |
for (var i=3;i<arguments.length;i++) | |
{ | |
ret.appendChild(arguments[i]); | |
} | |
core.markTreeReadonly(ret); | |
return ret; | |
}, | |
appendChild : function(/* Node */ arg) { | |
if (this.documentElement && arg.nodeType == ELEMENT_NODE) { | |
throw new core.DOMException(HIERARCHY_REQUEST_ERR); | |
} | |
return core.Node.prototype.appendChild.call(this, arg); | |
}, | |
removeChild : function(/* Node */ arg) { | |
var ret = core.Node.prototype.removeChild.call(this, arg); | |
if (arg == this._documentElement) { | |
this._documentElement = null;// force a recalculation | |
} | |
return ret; | |
}, | |
/* returns NodeList */ | |
getElementsByTagName: core.memoizeQuery(function(/* string */ name) { | |
function filterByTagName(child) { | |
if (child.nodeType && child.nodeType === ENTITY_REFERENCE_NODE) | |
{ | |
child = child._entity; | |
} | |
if (child.nodeName && child.nodeType === ELEMENT_NODE) | |
{ | |
if (name === "*") { | |
return true; | |
// case insensitivity for html | |
} else if (child._ownerDocument && child._ownerDocument._doctype && | |
//child._ownerDocument._doctype.name === "html" && | |
child.nodeName.toLowerCase() === name.toLowerCase()) | |
{ | |
return true; | |
} else if (child.nodeName.toLowerCase() === name.toLowerCase()) { | |
return true; | |
} | |
} | |
return false; | |
} | |
return new core.NodeList(this.documentElement || this, core.mapper(this, filterByTagName, true)); | |
}) | |
}); | |
core.CharacterData = function CharacterData(document, value) { | |
core.Node.call(this, document); | |
this._nodeValue = value + ""; | |
}; | |
inheritFrom(core.Node, core.CharacterData, { | |
get data() { return this._nodeValue;}, | |
set data(data) { | |
// readonly | |
if (this._readonly === true) { | |
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR); | |
} | |
this._nodeValue = data; | |
}, | |
/* returns int */ | |
get length() { return this._nodeValue.length || 0;}, | |
/* returns string */ | |
substringData: function(/* int */ offset, /* int */ count) { | |
if (count < 0 || offset < 0 || offset > this._nodeValue.length) { | |
throw new core.DOMException(INDEX_SIZE_ERR); | |
} | |
return (this._nodeValue.length < offset + count) ? | |
this._nodeValue.substring(offset) : | |
this._nodeValue.substring(offset, offset+count); | |
}, // raises: function(DOMException) {}, | |
/* returns string */ | |
appendData: function(/* string */ arg) { | |
// readonly | |
if (this._readonly === true) { | |
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR); | |
} | |
this._nodeValue+=arg; | |
return this._nodeValue; | |
}, // raises: function(DOMException) {}, | |
/* returns string */ | |
insertData: function(/* int */ offset, /* string */ arg) { | |
// readonly | |
if (this._readonly === true) { | |
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR); | |
} | |
if (offset < 0 || offset > this._nodeValue.length) { | |
throw new core.DOMException(INDEX_SIZE_ERR); | |
} | |
var start = this._nodeValue.substring(0,offset); | |
var end = this._nodeValue.substring(offset); | |
this._nodeValue = start + arg + end; | |
}, //raises: function(DOMException) {}, | |
/* returns void */ | |
deleteData: function(/* int */ offset, /* int */ count) { | |
// readonly | |
if (this._readonly === true) { | |
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR); | |
} | |
if (offset < 0 || | |
offset > this._nodeValue.length || | |
count < 0) | |
{ | |
throw new core.DOMException(INDEX_SIZE_ERR); | |
} | |
var start = this._nodeValue.substring(0,offset); | |
this._nodeValue = (offset+count<this._nodeValue.length) ? | |
start + this._nodeValue.substring(offset+count) : | |
start; | |
}, // raises: function(DOMException) {}, | |
/* returns void */ | |
replaceData: function(/* int */ offset, /* int */ count, /* string */ arg) { | |
// readonly | |
if (this._readonly === true) { | |
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR); | |
} | |
count = (offset+count > this._nodeValue.length) ? | |
this.nodeValue.length-offset : | |
count; | |
if (offset < 0 || | |
offset > this._nodeValue.length || | |
count < 0 /*|| | |
offset+count > this._nodeValue.length*/) | |
{ | |
throw new core.DOMException(INDEX_SIZE_ERR); | |
} | |
var start = this._nodeValue.substring(0,offset); | |
var end = this._nodeValue.substring(offset+count); | |
this._nodeValue = start + arg + end; | |
} // raises: function(DOMException) {}, | |
}); | |
core.Attr = function Attr(document, name, value) { | |
core.Node.call(this, document); | |
this._nodeValue = value; | |
this._name = name; | |
this._specified = (value) ? true : false; | |
this._tagName = name; | |
this._nodeName = name; | |
// Proactively set some level 2 information so that AttributeList | |
// can operate. | |
this._namespaceURI = null; | |
this._nodeName = name; | |
this._localName = name; | |
this._prefix = null; | |
}; | |
inheritFrom(core.Node, core.Attr, { | |
nodeType : ATTRIBUTE_NODE, | |
get nodeValue() { | |
var val = ''; | |
for (var i=0,len=this._childNodes.length;i<len;i++) { | |
var child = this._childNodes[i]; | |
if (child.nodeType === ENTITY_REFERENCE_NODE) { | |
val += Array.prototype.reduce.call(child.childNodes, function(prev, c) { | |
return prev += (c.nodeValue || c); | |
}, ''); | |
} else { | |
val += child.nodeValue; | |
} | |
} | |
return val; | |
}, | |
set nodeValue(value) { | |
// readonly | |
if (this._readonly) { | |
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR); | |
} | |
this._childNodes._resetTo([this._ownerDocument.createTextNode(value)]); | |
this._modified(); | |
this._specified = true; | |
var prev = this._nodeValue; | |
this._nodeValue = value; | |
if (this._ownerElement) { | |
this._ownerElement._attrModified(this._name, value, prev); | |
} | |
}, | |
get name() { return this._name;}, | |
get specified() { return this._specified }, | |
get value() { | |
return this.nodeValue; | |
}, | |
set value(value) { | |
this.nodeValue = value; | |
}, | |
get parentNode() { return null;}, | |
get attributes() { return null;}, | |
insertBefore : function(/* Node */ newChild, /* Node*/ refChild){ | |
if (newChild.nodeType === CDATA_SECTION_NODE || | |
newChild.nodeType === ELEMENT_NODE) | |
{ | |
throw new core.DOMException(HIERARCHY_REQUEST_ERR); | |
} | |
return core.Node.prototype.insertBefore.call(this, newChild, refChild); | |
}, | |
appendChild : function(/* Node */ arg) { | |
if (arg.nodeType === CDATA_SECTION_NODE || | |
arg.nodeType === ELEMENT_NODE) | |
{ | |
throw new core.DOMException(HIERARCHY_REQUEST_ERR); | |
} | |
return core.Node.prototype.appendChild.call(this, arg); | |
} | |
}); | |
core.Text = function Text(document, text, readonly) { | |
core.CharacterData.call(this, document, text); | |
this._nodeName = "#text"; | |
this._readonly = readonly ? true : false | |
}; | |
inheritFrom(core.CharacterData, core.Text, { | |
nodeType : TEXT_NODE, | |
get attributes() { return null;}, | |
/* returns Text */ | |
splitText: function(offset) { | |
// readonly | |
if (this._readonly) { | |
throw new core.DOMException(NO_MODIFICATION_ALLOWED_ERR); | |
} | |
if (offset < 0 || offset > this._nodeValue.length) { | |
throw new core.DOMException(INDEX_SIZE_ERR); | |
} | |
var newText = this._nodeValue.substring(offset); | |
this._nodeValue = this._nodeValue.substring(0, offset); | |
var newNode = this._ownerDocument.createTextNode(newText); | |
if(this._parentNode.lastChild === this) { | |
this._parentNode.appendChild(newNode); | |
} else { | |
this._parentNode.insertBefore(newNode, this.nextSibling); | |
} | |
return newNode; | |
}, //raises: function(DOMException) {}, | |
toString: function() { | |
return this.nodeName; | |
} | |
}); | |
core.Comment = function Comment(document, text) { | |
core.Text.call(this, document, text); | |
this._nodeName = "#comment"; | |
this._tagName = "#comment"; | |
}; | |
inheritFrom(core.Text, core.Comment, { | |
nodeType : COMMENT_NODE | |
}); | |
core.CDATASection = function CDATASection(document, value) { | |
core.Text.call(this, document, value); | |
this._nodeName = "#cdata-section"; | |
}; | |
inheritFrom(core.Text, core.CDATASection, { | |
nodeType : CDATA_SECTION_NODE | |
}); | |
core.DocumentType = function DocumentType(document, name, entities, notations, attributes) { | |
core.Node.call(this, document); | |
this._name = name; | |
this._tagName = name; | |
this._nodeName = name; | |
this._entities = entities || new core.EntityNodeMap(document); | |
this._notations = notations || new core.NotationNodeMap(document); | |
this._parentNode = document; | |
core.markTreeReadonly(this._notations); | |
this._attributes = attributes || new AttributeList(document); | |
}; | |
inheritFrom(core.Node, core.DocumentType, { | |
nodeType : DOCUMENT_TYPE_NODE, | |
get nodeValue() { return null;}, | |
set nodeValue(unused) { /* do nothing */ }, | |
get name() { return this._name;}, | |
get entities() { return this._entities;}, | |
get notations() { return this._notations;}, | |
get attributes() { return null;} | |
}); | |
core.Notation = function Notation(document, name, publicId, systemId){ | |
core.Node.call(this, document); | |
this._name = name; | |
this._nodeName = name; | |
this._publicId = publicId || null; | |
this._systemId = systemId || null; | |
this._nodeValue = null; | |
}; | |
inheritFrom(core.Node, core.Notation, { | |
nodeType : NOTATION_NODE, | |
get publicId() { return this._publicId;}, | |
get systemId() { return this._systemId;}, | |
get name() { return this._name || this._nodeName;}, | |
get attributes() { /* as per spec */ return null;}, | |
set nodeValue(unused) { /* intentionally left blank */ }, | |
get nodeValue() { return this._nodeValue;}, | |
}); | |
core.Entity = function Entity(document, name) { | |
core.Node.call(this, document); | |
this._name = name; | |
this._nodeName = name; | |
this._tagName = name; | |
this._publicId = null; | |
this._systemId = null; | |
this._notationName = null; | |
this._readonly = true; | |
}; | |
inheritFrom(core.Node, core.Entity, { | |
nodeType : ENTITY_NODE, | |
get nodeValue() { return null;}, | |
set nodeValue(unused) { | |
// readonly | |
if (this._readonly === true) { | |
// TODO: is this needed? | |
// throw new DOMException(NO_MODIFICATION_ALLOWED_ERR); | |
} | |
/* do nothing */ | |
}, | |
get name() { return this._name }, | |
get publicId() { return this._publicId;}, | |
get systemId() { return this._systemId;}, | |
set publicId(publicId) { this._publicId = publicId;}, | |
set systemId(systemId) { this._systemId = systemId;}, | |
set notationName(notationName) { this._notationName = notationName;}, | |
get notationName() { return this._notationName;}, | |
get attributes() { return null;}, | |
}); | |
core.EntityReference = function EntityReference(document, entity) { | |
core.Node.call(this, document); | |
this._entity = entity; | |
this._nodeName = (entity) ? entity.name : null; | |
this._readonly = true; | |
}; | |
inheritFrom(core.Node, core.EntityReference, { | |
nodeType : ENTITY_REFERENCE_NODE, | |
get nodeValue() { return (this._entity) ? this._entity.nodeValue : null;}, | |
set nodeValue(unused) { | |
// readonly | |
if (this._readonly === true) { | |
// TODO: is this needed? | |
//throw new DOMException(NO_MODIFICATION_ALLOWED_ERR); | |
} | |
/* do nothing */ | |
}, | |
get attributes() { return null;}, | |
// Proxy to the entity | |
get nodeName() { return this._entityName;}, | |
get firstChild() { return this._entity.firstChild || null;}, | |
get childNodes() { return this._entity.childNodes;}, | |
get lastChild() { return this._entity.lastChild || null;}, | |
}); | |
exports.dom = { "level1" : { "core" : core }}; | |
/***/ }, | |
/* 30 */ | |
/*!**********************************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/level2/languages/javascript.js ***! | |
\**********************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
exports.javascript = function(element, code, filename) { | |
var doc = element.ownerDocument, window = doc && doc.parentWindow; | |
if (window) { | |
try { | |
window.run(code, filename); | |
} catch (e) { | |
element.raise( | |
'error', 'Running ' + filename + ' failed.', | |
{error: e, filename: filename} | |
); | |
} | |
} | |
}; | |
/***/ }, | |
/* 31 */ | |
/*!******************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/level3/core.js ***! | |
\******************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var events = __webpack_require__(/*! ../level2/events */ 23), | |
core = __webpack_require__(/*! ../level2/core */ 22).dom.level2.core, | |
defineGetter = __webpack_require__(/*! ../utils */ 3).defineGetter, | |
defineSetter = __webpack_require__(/*! ../utils */ 3).defineSetter, | |
HtmlToDom = __webpack_require__(/*! ../browser/htmltodom */ 19).HtmlToDom, | |
domToHtml = __webpack_require__(/*! ../browser/domtohtml */ 8).domToHtml; | |
// modify cloned instance for more info check: https://github.com/tmpvar/jsdom/issues/325 | |
core = Object.create(core); | |
/* | |
valuetype DOMString sequence<unsigned short>; | |
typedef unsigned long long DOMTimeStamp; | |
typedef any DOMUserData; | |
typedef Object DOMObject; | |
*/ | |
// ExceptionCode | |
core.VALIDATION_ERR = 16; | |
core.TYPE_MISMATCH_ERR = 17; | |
/* | |
// Introduced in DOM Level 3: | |
interface NameList { | |
DOMString getName(in unsigned long index); | |
DOMString getNamespaceURI(in unsigned long index); | |
readonly attribute unsigned long length; | |
boolean contains(in DOMString str); | |
boolean containsNS(in DOMString namespaceURI, | |
in DOMString name); | |
}; | |
// Introduced in DOM Level 3: | |
interface DOMImplementationList { | |
DOMImplementation item(in unsigned long index); | |
readonly attribute unsigned long length; | |
}; | |
// Introduced in DOM Level 3: | |
interface DOMImplementationSource { | |
DOMImplementation getDOMImplementation(in DOMString features); | |
DOMImplementationList getDOMImplementationList(in DOMString features); | |
}; | |
*/ | |
core.DOMImplementation.prototype.getFeature = function(feature, version) { | |
}; | |
/* | |
interface Node { | |
// Modified in DOM Level 3: | |
Node insertBefore(in Node newChild, | |
in Node refChild) | |
raises(DOMException); | |
// Modified in DOM Level 3: | |
Node replaceChild(in Node newChild, | |
in Node oldChild) | |
raises(DOMException); | |
// Modified in DOM Level 3: | |
Node removeChild(in Node oldChild) | |
raises(DOMException); | |
// Modified in DOM Level 3: | |
Node appendChild(in Node newChild) | |
raises(DOMException); | |
boolean hasChildNodes(); | |
Node cloneNode(in boolean deep); | |
// Modified in DOM Level 3: | |
void normalize(); | |
// Introduced in DOM Level 3: | |
readonly attribute DOMString baseURI; | |
*/ | |
// Compare Document Position | |
var DOCUMENT_POSITION_DISCONNECTED = core.Node.DOCUMENT_POSITION_DISCONNECTED = | |
core.Node.prototype.DOCUMENT_POSITION_DISCONNECTED = 0x01; | |
var DOCUMENT_POSITION_PRECEDING = core.Node.DOCUMENT_POSITION_PRECEDING = | |
core.Node.prototype.DOCUMENT_POSITION_PRECEDING = 0x02; | |
var DOCUMENT_POSITION_FOLLOWING = core.Node.DOCUMENT_POSITION_FOLLOWING = | |
core.Node.prototype.DOCUMENT_POSITION_FOLLOWING = 0x04; | |
var DOCUMENT_POSITION_CONTAINS = core.Node.DOCUMENT_POSITION_CONTAINS = | |
core.Node.prototype.DOCUMENT_POSITION_CONTAINS = 0x08; | |
var DOCUMENT_POSITION_CONTAINED_BY = core.Node.DOCUMENT_POSITION_CONTAINED_BY = | |
core.Node.prototype.DOCUMENT_POSITION_CONTAINED_BY = 0x10; | |
var DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = core.Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = | |
core.Node.prototype.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; | |
var DOCUMENT_TYPE_NODE = core.Node.prototype.DOCUMENT_TYPE_NODE; | |
core.Node.prototype.compareDocumentPosition = function compareDocumentPosition( otherNode ) { | |
if( !(otherNode instanceof core.Node) ) { | |
throw Error("Comparing position against non-Node values is not allowed") | |
} | |
var thisOwner, otherOwner; | |
if( this.nodeType === this.DOCUMENT_NODE) | |
thisOwner = this | |
else | |
thisOwner = this.ownerDocument | |
if( otherNode.nodeType === this.DOCUMENT_NODE) | |
otherOwner = otherNode | |
else | |
otherOwner = otherNode.ownerDocument | |
if( this === otherNode ) return 0 | |
if( this === otherNode.ownerDocument ) return DOCUMENT_POSITION_FOLLOWING + DOCUMENT_POSITION_CONTAINED_BY | |
if( this.ownerDocument === otherNode ) return DOCUMENT_POSITION_PRECEDING + DOCUMENT_POSITION_CONTAINS | |
if( thisOwner !== otherOwner ) return DOCUMENT_POSITION_DISCONNECTED | |
// Text nodes for attributes does not have a _parentNode. So we need to find them as attribute child. | |
if( this.nodeType === this.ATTRIBUTE_NODE && this._childNodes && this._childNodes._toArray().indexOf(otherNode) !== -1) | |
return DOCUMENT_POSITION_FOLLOWING + DOCUMENT_POSITION_CONTAINED_BY | |
if( otherNode.nodeType === this.ATTRIBUTE_NODE && otherNode._childNodes && otherNode._childNodes._toArray().indexOf(this) !== -1) | |
return DOCUMENT_POSITION_PRECEDING + DOCUMENT_POSITION_CONTAINS | |
var point = this | |
var parents = [ ] | |
var previous = null | |
while( point ) { | |
if( point == otherNode ) return DOCUMENT_POSITION_PRECEDING + DOCUMENT_POSITION_CONTAINS | |
parents.push( point ) | |
point = point._parentNode | |
} | |
point = otherNode | |
previous = null | |
while( point ) { | |
if( point == this ) return DOCUMENT_POSITION_FOLLOWING + DOCUMENT_POSITION_CONTAINED_BY | |
var location_index = parents.indexOf( point ) | |
if( location_index !== -1) { | |
var smallest_common_ancestor = parents[ location_index ] | |
var this_index = smallest_common_ancestor._childNodes._toArray().indexOf( parents[location_index - 1] ) | |
var other_index = smallest_common_ancestor._childNodes._toArray().indexOf( previous ) | |
if( this_index > other_index ) { | |
return DOCUMENT_POSITION_PRECEDING | |
} | |
else { | |
return DOCUMENT_POSITION_FOLLOWING | |
} | |
} | |
previous = point | |
point = point._parentNode | |
} | |
return DOCUMENT_POSITION_DISCONNECTED | |
}; | |
/* | |
// Introduced in DOM Level 3: | |
attribute DOMString textContent; | |
// raises(DOMException) on setting | |
// raises(DOMException) on retrieval | |
*/ | |
core.Node.prototype.isSameNode = function(other) { | |
return (other === this); | |
}; | |
// @see http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Node3-textContent | |
defineGetter(core.Node.prototype, 'textContent', function() { | |
switch (this.nodeType) { | |
case this.COMMENT_NODE: | |
case this.CDATA_SECTION_NODE: | |
case this.PROCESSING_INSTRUCTION_NODE: | |
case this.TEXT_NODE: | |
return this.nodeValue; | |
case this.ATTRIBUTE_NODE: | |
case this.DOCUMENT_FRAGMENT_NODE: | |
case this.ELEMENT_NODE: | |
case this.ENTITY_NODE: | |
case this.ENTITY_REFERENCE_NODE: | |
var out = ''; | |
for (var i = 0 ; i < this.childNodes.length ; ++i) { | |
if (this.childNodes[i].nodeType !== this.COMMENT_NODE && | |
this.childNodes[i].nodeType !== this.PROCESSING_INSTRUCTION_NODE) { | |
out += this.childNodes[i].textContent || ''; | |
} | |
} | |
return out; | |
default: | |
return null; | |
} | |
}); | |
defineSetter(core.Node.prototype, 'textContent', function(txt) { | |
switch (this.nodeType) { | |
case this.COMMENT_NODE: | |
case this.CDATA_SECTION_NODE: | |
case this.PROCESSING_INSTRUCTION_NODE: | |
case this.TEXT_NODE: | |
return this.nodeValue = String(txt); | |
} | |
for (var i = this.childNodes.length; --i >=0;) { | |
this.removeChild(this.childNodes.item(i)); | |
} | |
if (txt !== "" && txt != null) { | |
this.appendChild(this._ownerDocument.createTextNode(txt)); | |
} | |
return txt; | |
}); | |
/* | |
// Introduced in DOM Level 3: | |
DOMString lookupPrefix(in DOMString namespaceURI); | |
// Introduced in DOM Level 3: | |
boolean isDefaultNamespace(in DOMString namespaceURI); | |
// Introduced in DOM Level 3: | |
DOMString lookupNamespaceURI(in DOMString prefix); | |
*/ | |
// Introduced in DOM Level 3: | |
core.Node.prototype.isEqualNode = function(other) { | |
var self = this; | |
var diffValues = function() { | |
for (var i=0;i<arguments.length;i++) { | |
var k = arguments[i]; | |
if (self[k] != other[k]) return(true); | |
} | |
return(false); | |
}; | |
var diffNamedNodeMaps = function(snnm, onnm) { | |
if ((snnm == null) && (onnm == null)) return(false); | |
if ((snnm == null) || (onnm == null)) return(true); | |
if (snnm.length != onnm.length) return(true); | |
var js = []; | |
for (var j=0;j<onnm.length;j++) { js[j] = j } | |
for (var i=0;i<snnm.length;i++) { | |
var found=false; | |
for (var j=0;j<js.length;j++) { | |
if (snnm.item(i).isEqualNode(onnm.item(js[j]))) { | |
found = true; | |
// in order to be 100% accurate, we remove index values from consideration once they've matched | |
js.splice(j,1); | |
break; | |
} | |
} | |
if (!found) return(true); | |
} | |
return(false); | |
}; | |
var diffNodeLists = function(snl, onl) { | |
if ((snl == null) && (onl == null)) return(false); | |
if ((snl == null) || (onl == null)) return(true); | |
if (snl.length != onl.length) return(true); | |
for (var i=0;i<snl.length;i++) { | |
if (!snl.item(i).isEqualNode(onl.item(i))) return(true); | |
} | |
return(false); | |
}; | |
if (!other) return(false); | |
if (this.isSameNode(other)) return(true); | |
if (this.nodeType != other.nodeType) return(false); | |
if (diffValues('nodeName', 'localName', 'namespaceURI', 'prefix', 'nodeValue')) return(false); | |
if (diffNamedNodeMaps(this.attributes, other.attributes)) return(false); | |
if (diffNodeLists(this.childNodes, other.childNodes)) return(false); | |
if (this.nodeType == DOCUMENT_TYPE_NODE) { | |
if (diffValues('publicId', 'systemId', 'internalSubset')) return(false); | |
if (diffNamedNodeMaps(this.entities, other.entities)) return(false); | |
if (diffNamedNodeMaps(this.notations, other.notations)) return(false); | |
} | |
return (true); | |
}; | |
/* | |
// Introduced in DOM Level 3: | |
DOMObject getFeature(in DOMString feature, | |
in DOMString version); | |
*/ | |
// Introduced in DOM Level 3: | |
core.Node.prototype.setUserData = function(key, data, handler) { | |
var r = this[key] || null; | |
this[key] = data; | |
return(r); | |
}; | |
// Introduced in DOM Level 3: | |
core.Node.prototype.getUserData = function(key) { | |
var r = this[key] || null; | |
return(r); | |
}; | |
/* | |
interface NodeList { | |
Node item(in unsigned long index); | |
readonly attribute unsigned long length; | |
}; | |
interface NamedNodeMap { | |
Node getNamedItem(in DOMString name); | |
Node setNamedItem(in Node arg) | |
raises(DOMException); | |
Node removeNamedItem(in DOMString name) | |
raises(DOMException); | |
Node item(in unsigned long index); | |
readonly attribute unsigned long length; | |
// Introduced in DOM Level 2: | |
Node getNamedItemNS(in DOMString namespaceURI, | |
in DOMString localName) | |
raises(DOMException); | |
// Introduced in DOM Level 2: | |
Node setNamedItemNS(in Node arg) | |
raises(DOMException); | |
// Introduced in DOM Level 2: | |
Node removeNamedItemNS(in DOMString namespaceURI, | |
in DOMString localName) | |
raises(DOMException); | |
}; | |
interface CharacterData : Node { | |
attribute DOMString data; | |
// raises(DOMException) on setting | |
// raises(DOMException) on retrieval | |
readonly attribute unsigned long length; | |
DOMString substringData(in unsigned long offset, | |
in unsigned long count) | |
raises(DOMException); | |
void appendData(in DOMString arg) | |
raises(DOMException); | |
void insertData(in unsigned long offset, | |
in DOMString arg) | |
raises(DOMException); | |
void deleteData(in unsigned long offset, | |
in unsigned long count) | |
raises(DOMException); | |
void replaceData(in unsigned long offset, | |
in unsigned long count, | |
in DOMString arg) | |
raises(DOMException); | |
}; | |
interface Attr : Node { | |
readonly attribute DOMString name; | |
readonly attribute boolean specified; | |
attribute DOMString value; | |
// raises(DOMException) on setting | |
// Introduced in DOM Level 2: | |
readonly attribute Element ownerElement; | |
// Introduced in DOM Level 3: | |
readonly attribute TypeInfo schemaTypeInfo; | |
*/ | |
// Introduced in DOM Level 3: | |
defineGetter(core.Attr.prototype, 'isId', function() { | |
return (this.name.toLowerCase() === 'id'); | |
}); | |
/* | |
}; | |
interface Element : Node { | |
readonly attribute DOMString tagName; | |
DOMString getAttribute(in DOMString name); | |
void setAttribute(in DOMString name, | |
in DOMString value) | |
raises(DOMException); | |
void removeAttribute(in DOMString name) | |
raises(DOMException); | |
Attr getAttributeNode(in DOMString name); | |
Attr setAttributeNode(in Attr newAttr) | |
raises(DOMException); | |
Attr removeAttributeNode(in Attr oldAttr) | |
raises(DOMException); | |
NodeList getElementsByTagName(in DOMString name); | |
// Introduced in DOM Level 2: | |
DOMString getAttributeNS(in DOMString namespaceURI, | |
in DOMString localName) | |
raises(DOMException); | |
// Introduced in DOM Level 2: | |
void setAttributeNS(in DOMString namespaceURI, | |
in DOMString qualifiedName, | |
in DOMString value) | |
raises(DOMException); | |
// Introduced in DOM Level 2: | |
void removeAttributeNS(in DOMString namespaceURI, | |
in DOMString localName) | |
raises(DOMException); | |
// Introduced in DOM Level 2: | |
Attr getAttributeNodeNS(in DOMString namespaceURI, | |
in DOMString localName) | |
raises(DOMException); | |
// Introduced in DOM Level 2: | |
Attr setAttributeNodeNS(in Attr newAttr) | |
raises(DOMException); | |
// Introduced in DOM Level 2: | |
NodeList getElementsByTagNameNS(in DOMString namespaceURI, | |
in DOMString localName) | |
raises(DOMException); | |
// Introduced in DOM Level 2: | |
boolean hasAttribute(in DOMString name); | |
// Introduced in DOM Level 2: | |
boolean hasAttributeNS(in DOMString namespaceURI, | |
in DOMString localName) | |
raises(DOMException); | |
// Introduced in DOM Level 3: | |
readonly attribute TypeInfo schemaTypeInfo; | |
// Introduced in DOM Level 3: | |
void setIdAttribute(in DOMString name, | |
in boolean isId) | |
raises(DOMException); | |
// Introduced in DOM Level 3: | |
void setIdAttributeNS(in DOMString namespaceURI, | |
in DOMString localName, | |
in boolean isId) | |
raises(DOMException); | |
// Introduced in DOM Level 3: | |
void setIdAttributeNode(in Attr idAttr, | |
in boolean isId) | |
raises(DOMException); | |
}; | |
interface Text : CharacterData { | |
Text splitText(in unsigned long offset) | |
raises(DOMException); | |
// Introduced in DOM Level 3: | |
readonly attribute boolean isElementContentWhitespace; | |
// Introduced in DOM Level 3: | |
readonly attribute DOMString wholeText; | |
// Introduced in DOM Level 3: | |
Text replaceWholeText(in DOMString content) | |
raises(DOMException); | |
}; | |
interface Comment : CharacterData { | |
}; | |
// Introduced in DOM Level 3: | |
interface TypeInfo { | |
readonly attribute DOMString typeName; | |
readonly attribute DOMString typeNamespace; | |
// DerivationMethods | |
const unsigned long DERIVATION_RESTRICTION = 0x00000001; | |
const unsigned long DERIVATION_EXTENSION = 0x00000002; | |
const unsigned long DERIVATION_UNION = 0x00000004; | |
const unsigned long DERIVATION_LIST = 0x00000008; | |
boolean isDerivedFrom(in DOMString typeNamespaceArg, | |
in DOMString typeNameArg, | |
in unsigned long derivationMethod); | |
}; | |
*/ | |
// Introduced in DOM Level 3: | |
core.UserDataHandler = function() {}; | |
core.UserDataHandler.prototype.NODE_CLONED = 1; | |
core.UserDataHandler.prototype.NODE_IMPORTED = 2; | |
core.UserDataHandler.prototype.NODE_DELETED = 3; | |
core.UserDataHandler.prototype.NODE_RENAMED = 4; | |
core.UserDataHandler.prototype.NODE_ADOPTED = 5; | |
core.UserDataHandler.prototype.handle = function(operation, key, data, src, dst) {}; | |
// Introduced in DOM Level 3: | |
core.DOMError = function(severity, message, type, relatedException, relatedData, location) { | |
this._severity = severity; | |
this._message = message; | |
this._type = type; | |
this._relatedException = relatedException; | |
this._relatedData = relatedData; | |
this._location = location; | |
}; | |
core.DOMError.prototype = {}; | |
core.DOMError.prototype.SEVERITY_WARNING = 1; | |
core.DOMError.prototype.SEVERITY_ERROR = 2; | |
core.DOMError.prototype.SEVERITY_FATAL_ERROR = 3; | |
defineGetter(core.DOMError.prototype, 'severity', function() { | |
return this._severity; | |
}); | |
defineGetter(core.DOMError.prototype, 'message', function() { | |
return this._message; | |
}); | |
defineGetter(core.DOMError.prototype, 'type', function() { | |
return this._type; | |
}); | |
defineGetter(core.DOMError.prototype, 'relatedException', function() { | |
return this._relatedException; | |
}); | |
defineGetter(core.DOMError.prototype, 'relatedData', function() { | |
return this._relatedData; | |
}); | |
defineGetter(core.DOMError.prototype, 'location', function() { | |
return this._location; | |
}); | |
/* | |
// Introduced in DOM Level 3: | |
interface DOMErrorHandler { | |
boolean handleError(in DOMError error); | |
}; | |
// Introduced in DOM Level 3: | |
interface DOMLocator { | |
readonly attribute long lineNumber; | |
readonly attribute long columnNumber; | |
readonly attribute long byteOffset; | |
readonly attribute long utf16Offset; | |
readonly attribute Node relatedNode; | |
readonly attribute DOMString uri; | |
}; | |
*/ | |
// Introduced in DOM Level 3: | |
core.DOMConfiguration = function(){ | |
var possibleParameterNames = { | |
'canonical-form': [false, true], // extra rules for true | |
'cdata-sections': [true, false], | |
'check-character-normalization': [false, true], | |
'comments': [true, false], | |
'datatype-normalization': [false, true], | |
'element-content-whitespace': [true, false], | |
'entities': [true, false], | |
// 'error-handler': [], | |
'infoset': [undefined, true, false], // extra rules for true | |
'namespaces': [true, false], | |
'namespace-declarations': [true, false], // only checked if namespaces is true | |
'normalize-characters': [false, true], | |
// 'schema-location': [], | |
// 'schema-type': [], | |
'split-cdata-sections': [true, false], | |
'validate': [false, true], | |
'validate-if-schema': [false, true], | |
'well-formed': [true, false] | |
} | |
}; | |
core.DOMConfiguration.prototype = { | |
setParameter: function(name, value) {}, | |
getParameter: function(name) {}, | |
canSetParameter: function(name, value) {}, | |
parameterNames: function() {} | |
}; | |
//core.Document.prototype._domConfig = new core.DOMConfiguration(); | |
defineGetter(core.Document.prototype, 'domConfig', function() { | |
return this._domConfig || new core.DOMConfiguration();; | |
}); | |
// Introduced in DOM Level 3: | |
core.DOMStringList = function() {}; | |
core.DOMStringList.prototype = { | |
item: function() {}, | |
length: function() {}, | |
contains: function() {} | |
}; | |
/* | |
interface CDATASection : Text { | |
}; | |
interface DocumentType : Node { | |
readonly attribute DOMString name; | |
readonly attribute NamedNodeMap entities; | |
readonly attribute NamedNodeMap notations; | |
// Introduced in DOM Level 2: | |
readonly attribute DOMString publicId; | |
// Introduced in DOM Level 2: | |
readonly attribute DOMString systemId; | |
// Introduced in DOM Level 2: | |
readonly attribute DOMString internalSubset; | |
}; | |
interface Notation : Node { | |
readonly attribute DOMString publicId; | |
readonly attribute DOMString systemId; | |
}; | |
interface Entity : Node { | |
readonly attribute DOMString publicId; | |
readonly attribute DOMString systemId; | |
readonly attribute DOMString notationName; | |
// Introduced in DOM Level 3: | |
readonly attribute DOMString inputEncoding; | |
// Introduced in DOM Level 3: | |
readonly attribute DOMString xmlEncoding; | |
// Introduced in DOM Level 3: | |
readonly attribute DOMString xmlVersion; | |
}; | |
interface EntityReference : Node { | |
}; | |
interface ProcessingInstruction : Node { | |
readonly attribute DOMString target; | |
attribute DOMString data; | |
// raises(DOMException) on setting | |
}; | |
interface DocumentFragment : Node { | |
}; | |
interface Document : Node { | |
// Modified in DOM Level 3: | |
readonly attribute DocumentType doctype; | |
readonly attribute DOMImplementation implementation; | |
readonly attribute Element documentElement; | |
Element createElement(in DOMString tagName) | |
raises(DOMException); | |
DocumentFragment createDocumentFragment(); | |
Text createTextNode(in DOMString data); | |
Comment createComment(in DOMString data); | |
CDATASection createCDATASection(in DOMString data) | |
raises(DOMException); | |
ProcessingInstruction createProcessingInstruction(in DOMString target, | |
in DOMString data) | |
raises(DOMException); | |
Attr createAttribute(in DOMString name) | |
raises(DOMException); | |
EntityReference createEntityReference(in DOMString name) | |
raises(DOMException); | |
NodeList getElementsByTagName(in DOMString tagname); | |
// Introduced in DOM Level 2: | |
Node importNode(in Node importedNode, | |
in boolean deep) | |
raises(DOMException); | |
// Introduced in DOM Level 2: | |
Element createElementNS(in DOMString namespaceURI, | |
in DOMString qualifiedName) | |
raises(DOMException); | |
// Introduced in DOM Level 2: | |
Attr createAttributeNS(in DOMString namespaceURI, | |
in DOMString qualifiedName) | |
raises(DOMException); | |
// Introduced in DOM Level 2: | |
NodeList getElementsByTagNameNS(in DOMString namespaceURI, | |
in DOMString localName); | |
// Introduced in DOM Level 2: | |
Element getElementById(in DOMString elementId); | |
*/ | |
// Introduced in DOM Level 3: | |
core.Document.prototype._inputEncoding = null; | |
defineGetter(core.Document.prototype, 'inputEncoding', function() { | |
return this._inputEncoding; | |
}); | |
/* | |
// Introduced in DOM Level 3: | |
readonly attribute DOMString xmlEncoding; | |
// Introduced in DOM Level 3: | |
attribute boolean xmlStandalone; | |
// raises(DOMException) on setting | |
// Introduced in DOM Level 3: | |
attribute DOMString xmlVersion; | |
// raises(DOMException) on setting | |
// Introduced in DOM Level 3: | |
attribute boolean strictErrorChecking; | |
// Introduced in DOM Level 3: | |
attribute DOMString documentURI; | |
// Introduced in DOM Level 3: | |
Node adoptNode(in Node source) | |
raises(DOMException); | |
// Introduced in DOM Level 3: | |
readonly attribute DOMConfiguration domConfig; | |
// Introduced in DOM Level 3: | |
void normalizeDocument(); | |
// Introduced in DOM Level 3: | |
Node renameNode(in Node n, | |
in DOMString namespaceURI, | |
in DOMString qualifiedName) | |
raises(DOMException); | |
}; | |
}; | |
#endif // _DOM_IDL_ | |
*/ | |
exports.dom = { | |
level3 : { | |
core: core | |
} | |
}; | |
/***/ }, | |
/* 32 */ | |
/*!********************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/level3/events.js ***! | |
\********************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var events = __webpack_require__(/*! ../level2/events */ 23).dom.level2.events; | |
// modify cloned instance for more info check: https://github.com/tmpvar/jsdom/issues/325 | |
events = Object.create(events); | |
/* | |
// File: events.idl | |
#ifndef _EVENTS_IDL_ | |
#define _EVENTS_IDL_ | |
#include "dom.idl" | |
#include "views.idl" | |
#pragma prefix "dom.w3c.org" | |
module events | |
{ | |
typedef dom::DOMString DOMString; | |
typedef dom::DOMTimeStamp DOMTimeStamp; | |
typedef dom::DOMObject DOMObject; | |
typedef dom::Node Node; | |
interface EventTarget; | |
interface EventListener; | |
// Introduced in DOM Level 2: | |
exception EventException { | |
unsigned short code; | |
}; | |
// EventExceptionCode | |
const unsigned short UNSPECIFIED_EVENT_TYPE_ERR = 0; | |
// Introduced in DOM Level 3: | |
const unsigned short DISPATCH_REQUEST_ERR = 1; | |
// Introduced in DOM Level 2: | |
interface Event { | |
// PhaseType | |
const unsigned short CAPTURING_PHASE = 1; | |
const unsigned short AT_TARGET = 2; | |
const unsigned short BUBBLING_PHASE = 3; | |
readonly attribute DOMString type; | |
readonly attribute EventTarget target; | |
readonly attribute EventTarget currentTarget; | |
readonly attribute unsigned short eventPhase; | |
readonly attribute boolean bubbles; | |
readonly attribute boolean cancelable; | |
readonly attribute DOMTimeStamp timeStamp; | |
void stopPropagation(); | |
void preventDefault(); | |
void initEvent(in DOMString eventTypeArg, | |
in boolean canBubbleArg, | |
in boolean cancelableArg); | |
// Introduced in DOM Level 3: | |
readonly attribute DOMString namespaceURI; | |
// Introduced in DOM Level 3: | |
boolean isCustom(); | |
// Introduced in DOM Level 3: | |
void stopImmediatePropagation(); | |
// Introduced in DOM Level 3: | |
boolean isDefaultPrevented(); | |
// Introduced in DOM Level 3: | |
void initEventNS(in DOMString namespaceURIArg, | |
in DOMString eventTypeArg, | |
in boolean canBubbleArg, | |
in boolean cancelableArg); | |
}; | |
// Introduced in DOM Level 2: | |
interface EventTarget { | |
void addEventListener(in DOMString type, | |
in EventListener listener, | |
in boolean useCapture); | |
void removeEventListener(in DOMString type, | |
in EventListener listener, | |
in boolean useCapture); | |
// Modified in DOM Level 3: | |
boolean dispatchEvent(in Event evt) | |
raises(EventException); | |
// Introduced in DOM Level 3: | |
void addEventListenerNS(in DOMString namespaceURI, | |
in DOMString type, | |
in EventListener listener, | |
in boolean useCapture, | |
in DOMObject evtGroup); | |
// Introduced in DOM Level 3: | |
void removeEventListenerNS(in DOMString namespaceURI, | |
in DOMString type, | |
in EventListener listener, | |
in boolean useCapture); | |
// Introduced in DOM Level 3: | |
boolean willTriggerNS(in DOMString namespaceURI, | |
in DOMString type); | |
// Introduced in DOM Level 3: | |
boolean hasEventListenerNS(in DOMString namespaceURI, | |
in DOMString type); | |
}; | |
// Introduced in DOM Level 2: | |
interface EventListener { | |
void handleEvent(in Event evt); | |
}; | |
// Introduced in DOM Level 2: | |
interface DocumentEvent { | |
Event createEvent(in DOMString eventType) | |
raises(dom::DOMException); | |
// Introduced in DOM Level 3: | |
boolean canDispatch(in DOMString namespaceURI, | |
in DOMString type); | |
}; | |
// Introduced in DOM Level 3: | |
interface CustomEvent : Event { | |
void setDispatchState(in EventTarget target, | |
in unsigned short phase); | |
boolean isPropagationStopped(); | |
boolean isImmediatePropagationStopped(); | |
}; | |
// Introduced in DOM Level 2: | |
interface UIEvent : Event { | |
readonly attribute views::AbstractView view; | |
readonly attribute long detail; | |
void initUIEvent(in DOMString typeArg, | |
in boolean canBubbleArg, | |
in boolean cancelableArg, | |
in views::AbstractView viewArg, | |
in long detailArg); | |
// Introduced in DOM Level 3: | |
void initUIEventNS(in DOMString namespaceURI, | |
in DOMString typeArg, | |
in boolean canBubbleArg, | |
in boolean cancelableArg, | |
in views::AbstractView viewArg, | |
in long detailArg); | |
}; | |
// Introduced in DOM Level 3: | |
interface TextEvent : UIEvent { | |
readonly attribute DOMString data; | |
void initTextEvent(in DOMString typeArg, | |
in boolean canBubbleArg, | |
in boolean cancelableArg, | |
in views::AbstractView viewArg, | |
in DOMString dataArg); | |
void initTextEventNS(in DOMString namespaceURI, | |
in DOMString type, | |
in boolean canBubbleArg, | |
in boolean cancelableArg, | |
in views::AbstractView viewArg, | |
in DOMString dataArg); | |
}; | |
// Introduced in DOM Level 2: | |
interface MouseEvent : UIEvent { | |
readonly attribute long screenX; | |
readonly attribute long screenY; | |
readonly attribute long clientX; | |
readonly attribute long clientY; | |
readonly attribute boolean ctrlKey; | |
readonly attribute boolean shiftKey; | |
readonly attribute boolean altKey; | |
readonly attribute boolean metaKey; | |
readonly attribute unsigned short button; | |
readonly attribute EventTarget relatedTarget; | |
void initMouseEvent(in DOMString typeArg, | |
in boolean canBubbleArg, | |
in boolean cancelableArg, | |
in views::AbstractView viewArg, | |
in long detailArg, | |
in long screenXArg, | |
in long screenYArg, | |
in long clientXArg, | |
in long clientYArg, | |
in boolean ctrlKeyArg, | |
in boolean altKeyArg, | |
in boolean shiftKeyArg, | |
in boolean metaKeyArg, | |
in unsigned short buttonArg, | |
in EventTarget relatedTargetArg); | |
// Introduced in DOM Level 3: | |
boolean getModifierState(in DOMString keyIdentifierArg); | |
// Introduced in DOM Level 3: | |
void initMouseEventNS(in DOMString namespaceURI, | |
in DOMString typeArg, | |
in boolean canBubbleArg, | |
in boolean cancelableArg, | |
in views::AbstractView viewArg, | |
in long detailArg, | |
in long screenXArg, | |
in long screenYArg, | |
in long clientXArg, | |
in long clientYArg, | |
in unsigned short buttonArg, | |
in EventTarget relatedTargetArg, | |
in DOMString modifiersList); | |
}; | |
// Introduced in DOM Level 3: | |
interface KeyboardEvent : UIEvent { | |
// KeyLocationCode | |
const unsigned long DOM_KEY_LOCATION_STANDARD = 0x00; | |
const unsigned long DOM_KEY_LOCATION_LEFT = 0x01; | |
const unsigned long DOM_KEY_LOCATION_RIGHT = 0x02; | |
const unsigned long DOM_KEY_LOCATION_NUMPAD = 0x03; | |
readonly attribute DOMString keyIdentifier; | |
readonly attribute unsigned long keyLocation; | |
readonly attribute boolean ctrlKey; | |
readonly attribute boolean shiftKey; | |
readonly attribute boolean altKey; | |
readonly attribute boolean metaKey; | |
boolean getModifierState(in DOMString keyIdentifierArg); | |
void initKeyboardEvent(in DOMString typeArg, | |
in boolean canBubbleArg, | |
in boolean cancelableArg, | |
in views::AbstractView viewArg, | |
in DOMString keyIdentifierArg, | |
in unsigned long keyLocationArg, | |
in DOMString modifiersList); | |
void initKeyboardEventNS(in DOMString namespaceURI, | |
in DOMString typeArg, | |
in boolean canBubbleArg, | |
in boolean cancelableArg, | |
in views::AbstractView viewArg, | |
in DOMString keyIdentifierArg, | |
in unsigned long keyLocationArg, | |
in DOMString modifiersList); | |
}; | |
// Introduced in DOM Level 2: | |
interface MutationEvent : Event { | |
// attrChangeType | |
const unsigned short MODIFICATION = 1; | |
const unsigned short ADDITION = 2; | |
const unsigned short REMOVAL = 3; | |
readonly attribute Node relatedNode; | |
readonly attribute DOMString prevValue; | |
readonly attribute DOMString newValue; | |
readonly attribute DOMString attrName; | |
readonly attribute unsigned short attrChange; | |
void initMutationEvent(in DOMString typeArg, | |
in boolean canBubbleArg, | |
in boolean cancelableArg, | |
in Node relatedNodeArg, | |
in DOMString prevValueArg, | |
in DOMString newValueArg, | |
in DOMString attrNameArg, | |
in unsigned short attrChangeArg); | |
// Introduced in DOM Level 3: | |
void initMutationEventNS(in DOMString namespaceURI, | |
in DOMString typeArg, | |
in boolean canBubbleArg, | |
in boolean cancelableArg, | |
in Node relatedNodeArg, | |
in DOMString prevValueArg, | |
in DOMString newValueArg, | |
in DOMString attrNameArg, | |
in unsigned short attrChangeArg); | |
}; | |
// Introduced in DOM Level 3: | |
interface MutationNameEvent : MutationEvent { | |
readonly attribute DOMString prevNamespaceURI; | |
readonly attribute DOMString prevNodeName; | |
// Introduced in DOM Level 3: | |
void initMutationNameEvent(in DOMString typeArg, | |
in boolean canBubbleArg, | |
in boolean cancelableArg, | |
in Node relatedNodeArg, | |
in DOMString prevNamespaceURIArg, | |
in DOMString prevNodeNameArg); | |
// Introduced in DOM Level 3: | |
void initMutationNameEventNS(in DOMString namespaceURI, | |
in DOMString typeArg, | |
in boolean canBubbleArg, | |
in boolean cancelableArg, | |
in Node relatedNodeArg, | |
in DOMString prevNamespaceURIArg, | |
in DOMString prevNodeNameArg); | |
}; | |
}; | |
#endif // _EVENTS_IDL_ | |
*/ | |
exports.dom = { | |
level3 : { | |
events: events | |
} | |
} | |
/***/ }, | |
/* 33 */ | |
/*!******************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/level3/html.js ***! | |
\******************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var core = __webpack_require__(/*! ./core */ 31).dom.level3.core, | |
html = __webpack_require__(/*! ../level2/html */ 5).dom.level2.html | |
exports.dom = { | |
level3 : { | |
html : html, | |
core : core | |
} | |
}; | |
/***/ }, | |
/* 34 */ | |
/*!*******************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/level3/index.js ***! | |
\*******************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
module.exports.dom = { | |
level3 : { | |
core : __webpack_require__(/*! ./core */ 31).dom.level3.core, | |
xpath : __webpack_require__(/*! ./xpath */ 36), | |
events : __webpack_require__(/*! ./events */ 32).dom.level3.events, | |
html : __webpack_require__(/*! ./html */ 33).dom.level3.html, | |
} | |
}; | |
module.exports.dom.ls = __webpack_require__(/*! ./ls */ 35).dom.level3.ls; | |
/***/ }, | |
/* 35 */ | |
/*!****************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/level3/ls.js ***! | |
\****************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
// w3c Load/Save functionality: http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/ | |
var core = __webpack_require__(/*! ./core */ 31).dom.level3.core; | |
var events = __webpack_require__(/*! ./events */ 32).dom.level3.events; | |
var createFrom = __webpack_require__(/*! ../utils */ 3).createFrom; | |
var ls = {}; | |
// TODO: what is this? | |
//typedef dom::DOMConfiguration DOMConfiguration; | |
ls.LSException = function LSException(code) { | |
this.code = code; | |
}; | |
ls.LSException.prototype = { | |
// LSExceptionCode | |
PARSE_ERR : 81, | |
SERIALIZE_ERR : 82 | |
}; | |
ls.DOMImplementationLS = function DOMImplementationLS() { | |
}; | |
var DOMImplementationExtension = { | |
// DOMImplementationLSMode | |
MODE_SYNCHRONOUS : 1, | |
MODE_ASYNCHRONOUS : 2, | |
// raises(dom::DOMException); | |
createLSParser : function(/* int */ mode, /* string */ schemaType) { | |
return new ls.LSParser(mode, schemaType); | |
}, | |
createLSSerializer : function() { | |
return new ls.LSSerializer(); | |
}, | |
createLSInput : function() { | |
return new ls.LSInput(); | |
}, | |
createLSOutput : function() { | |
return new ls.LSOutput(); | |
} | |
}; | |
Object.keys(DOMImplementationExtension).forEach(function(k, v) { | |
core.DOMImplementation.prototype[k] = DOMImplementationExtension[k]; | |
}); | |
ls.DOMImplementationLS.prototype = DOMImplementationExtension; | |
core.Document.getFeature = function() { | |
return DOMImplementationExtension; | |
}; | |
ls.LSParser = function LSParser() { | |
this._domConfig = new core.DOMConfiguration(); | |
}; | |
ls.LSParser.prototype = { | |
get domConfig() { return this._domConfig; }, | |
get filter() { return this._filter || null; }, | |
set filter(value) { this._filter = value; }, | |
get async() { return this._async; }, | |
get busy() { return this._busy; }, | |
// raises(dom::DOMException, LSException); | |
parse : function (/* LSInput */ input) { | |
var doc = new core.Document(); | |
doc._inputEncoding = 'UTF-16'; | |
return doc; | |
}, | |
// raises(dom::DOMException, LSException); | |
parseURI : function(/* string */ uri) { | |
return new core.Document(); | |
}, | |
// ACTION_TYPES | |
ACTION_APPEND_AS_CHILDREN : 1, | |
ACTION_REPLACE_CHILDREN : 2, | |
ACTION_INSERT_BEFORE : 3, | |
ACTION_INSERT_AFTER : 4, | |
ACTION_REPLACE : 5, | |
// @returns Node | |
// @raises DOMException, LSException | |
parseWithContext : function(/* LSInput */ input, /* Node */ contextArg, /* int */ action) { | |
return new core.Node(); | |
}, | |
abort : function() { | |
// TODO: implement | |
} | |
}; | |
ls.LSInput = function LSInput() {}; | |
ls.LSInput.prototype = { | |
get characterStream() { return this._characterStream || null; }, | |
set characterStream(value) { this._characterStream = value; }, | |
get byteStream() { return this._byteStream || null; }, | |
set byteStream(value) { this._byteStream = value; }, | |
get stringData() { return this._stringData || null; }, | |
set stringData(value) { this._stringData = value; }, | |
get systemId() { return this._systemId || null; }, | |
set systemId(value) { this._systemId = value; }, | |
get publicId() { return this._publicId || null; }, | |
set publicId(value) { this._publicId = value; }, | |
get baseURI() { return this._baseURI || null; }, | |
set baseURI(value) { this._baseURI = value; }, | |
get encoding() { return this._encoding || null; }, | |
set encoding(value) { this._encoding = value; }, | |
get certifiedText() { return this._certifiedText || null; }, | |
set certifiedText(value) { this._certifiedText = value; }, | |
}; | |
ls.LSResourceResolver = function LSResourceResolver() {}; | |
// @returns LSInput | |
ls.LSResourceResolver.prototype.resolveResource = function(type, namespaceURI, publicId, systemId, baseURI) { | |
return new ls.LSInput(); | |
}; | |
ls.LSParserFilter = function LSParserFilter() {}; | |
ls.LSParserFilter.prototype = { | |
// Constants returned by startElement and acceptNode | |
FILTER_ACCEPT : 1, | |
FILTER_REJECT : 2, | |
FILTER_SKIP : 3, | |
FILTER_INTERRUPT : 4, | |
get whatToShow() { return this._whatToShow; }, | |
// @returns int | |
startElement : function(/* Element */ elementArg) { | |
return 0; | |
}, | |
// @returns int | |
acceptNode : function(/* Node */ nodeArg) { | |
return nodeArg; | |
} | |
}; | |
ls.LSSerializer = function LSSerializer() { | |
this._domConfig = new core.DOMConfiguration(); | |
}; | |
ls.LSSerializer.prototype = { | |
get domConfig() { return this._domConfig; }, | |
get newLine() { return this._newLine || null; }, | |
set newLine(value) { this._newLine = value; }, | |
get filter() { return this._filter || null; }, | |
set filter(value) { this._filter = value; }, | |
// @returns boolean | |
// @raises LSException | |
write : function(/* Node */ nodeArg, /* LSOutput */ destination) { | |
return true; | |
}, | |
// @returns boolean | |
// @raises LSException | |
writeToURI : function(/* Node */ nodeArg, /* string */ uri) { | |
return true; | |
}, | |
// @returns string | |
// @raises DOMException, LSException | |
writeToString : function(/* Node */ nodeArg) { | |
return ""; | |
} | |
}; | |
ls.LSOutput = function LSOutput() {}; | |
ls.LSOutput.prototype = { | |
get characterStream() { return this._characterStream || null; }, | |
set characterStream(value) { this._characterStream = value; }, | |
get byteStream() { return this._byteStream || null; }, | |
set byteStream(value) { this._byteStream = value; }, | |
get systemId() { return this._systemId || null; }, | |
set systemId(value) { this._systemId = value; }, | |
get encoding() { return this._encoding || null; }, | |
set encoding(value) { this._encoding = value; }, | |
}; | |
ls.LSProgressEvent = function LSProgressEvent() {}; | |
ls.LSProgressEvent.prototype = createFrom(events.Event, { | |
constructor: ls.LSProgressEvent, | |
get input() { return this._input; }, | |
get position() { return this._position; }, | |
get totalSize() { return this._totalSize; }, | |
}); | |
ls.LSLoadEvent = function LSLoadEvent() {}; | |
ls.LSLoadEvent.prototype = createFrom(events.Event, { | |
get newDocument() { return this._newDocument; }, | |
get input() { return this._input; }, | |
}); | |
// TODO: do traversal | |
ls.LSSerializerFilter = function LSSerializerFilter() {}; | |
ls.LSSerializerFilter.prototype = { | |
get whatToShow() { return this._whatToShow; }, | |
}; | |
// ls.LSSerializerFilter.prototype.__proto__ = level2.traversal.NodeFiler; | |
// Export | |
module.exports.dom = { | |
level3 : { | |
ls : ls | |
} | |
}; | |
/***/ }, | |
/* 36 */ | |
/*!*******************************************!*\ | |
!*** ./~/jsdom/lib/jsdom/level3/xpath.js ***! | |
\*******************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
/** Here is yet another implementation of XPath 1.0 in Javascript. | |
* | |
* My goal was to make it relatively compact, but as I fixed all the axis bugs | |
* the axes became more and more complicated. :-(. | |
* | |
* I have not implemented namespaces or case-sensitive axes for XML yet. | |
* | |
* How to test it in Chrome: You can make a Chrome extension that replaces | |
* the WebKit XPath parser with this one. But it takes a bit of effort to | |
* get around isolated world and same-origin restrictions: | |
* manifest.json: | |
{ | |
"name": "XPathTest", | |
"version": "0.1", | |
"content_scripts": [{ | |
"matches": ["http://localhost/*"], // or wildcard host | |
"js": ["xpath.js", "injection.js"], | |
"all_frames": true, "run_at": "document_start" | |
}] | |
} | |
* injection.js: | |
// goal: give my xpath object to the website's JS context. | |
var script = document.createElement('script'); | |
script.textContent = | |
"document.addEventListener('xpathextend', function(e) {\n" + | |
" console.log('extending document with xpath...');\n" + | |
" e.detail(window);" + | |
"});"; | |
document.documentElement.appendChild(script); | |
document.documentElement.removeChild(script); | |
var evt = document.createEvent('CustomEvent'); | |
evt.initCustomEvent('xpathextend', true, true, this.xpath.extend); | |
document.dispatchEvent(evt); | |
*/ | |
(function() { | |
var core; | |
var xpath; | |
if (true) { | |
core = __webpack_require__(/*! ../level3/core */ 31).dom.level3.core; | |
xpath = exports; | |
} else { | |
core = this; | |
xpath = {}; | |
} | |
/*************************************************************************** | |
* Tokenization * | |
***************************************************************************/ | |
/** | |
* The XPath lexer is basically a single regular expression, along with | |
* some helper functions to pop different types. | |
*/ | |
var Stream = xpath.Stream = function Stream(str) { | |
this.original = this.str = str; | |
this.peeked = null; | |
// TODO: not really needed, but supposedly tokenizer also disambiguates | |
// a * b vs. node test * | |
this.prev = null; // for debugging | |
this.prevprev = null; | |
} | |
Stream.prototype = { | |
peek: function() { | |
if (this.peeked) return this.peeked; | |
var m = this.re.exec(this.str); | |
if (!m) return null; | |
this.str = this.str.substr(m[0].length); | |
return this.peeked = m[1]; | |
}, | |
/** Peek 2 tokens ahead. */ | |
peek2: function() { | |
this.peek(); // make sure this.peeked is set | |
var m = this.re.exec(this.str); | |
if (!m) return null; | |
return m[1]; | |
}, | |
pop: function() { | |
var r = this.peek(); | |
this.peeked = null; | |
this.prevprev = this.prev; | |
this.prev = r; | |
return r; | |
}, | |
trypop: function(tokens) { | |
var tok = this.peek(); | |
if (tok === tokens) return this.pop(); | |
if (Array.isArray(tokens)) { | |
for (var i = 0; i < tokens.length; ++i) { | |
var t = tokens[i]; | |
if (t == tok) return this.pop();; | |
} | |
} | |
}, | |
trypopfuncname: function() { | |
var tok = this.peek(); | |
if (!this.isQnameRe.test(tok)) | |
return null; | |
switch (tok) { | |
case 'comment': case 'text': case 'processing-instruction': case 'node': | |
return null; | |
} | |
if ('(' != this.peek2()) return null; | |
return this.pop(); | |
}, | |
trypopaxisname: function() { | |
var tok = this.peek(); | |
switch (tok) { | |
case 'ancestor': case 'ancestor-or-self': case 'attribute': | |
case 'child': case 'descendant': case 'descendant-or-self': | |
case 'following': case 'following-sibling': case 'namespace': | |
case 'parent': case 'preceding': case 'preceding-sibling': case 'self': | |
if ('::' == this.peek2()) return this.pop(); | |
} | |
return null; | |
}, | |
trypopnametest: function() { | |
var tok = this.peek(); | |
if ('*' === tok || this.startsWithNcNameRe.test(tok)) return this.pop(); | |
return null; | |
}, | |
trypopliteral: function() { | |
var tok = this.peek(); | |
if (null == tok) return null; | |
var first = tok.charAt(0); | |
var last = tok.charAt(tok.length - 1); | |
if ('"' === first && '"' === last || | |
"'" === first && "'" === last) { | |
this.pop(); | |
return tok.substr(1, tok.length - 2); | |
} | |
}, | |
trypopnumber: function() { | |
var tok = this.peek(); | |
if (this.isNumberRe.test(tok)) return parseFloat(this.pop()); | |
else return null; | |
}, | |
trypopvarref: function() { | |
var tok = this.peek(); | |
if (null == tok) return null; | |
if ('$' === tok.charAt(0)) return this.pop().substr(1); | |
else return null; | |
}, | |
position: function() { | |
return this.original.length - this.str.length; | |
} | |
}; | |
(function() { | |
// http://www.w3.org/TR/REC-xml-names/#NT-NCName | |
var nameStartCharsExceptColon = | |
'A-Z_a-z\xc0-\xd6\xd8-\xf6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF' + | |
'\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF' + | |
'\uFDF0-\uFFFD'; // JS doesn't support [#x10000-#xEFFFF] | |
var nameCharExceptColon = nameStartCharsExceptColon + | |
'\\-\\.0-9\xb7\u0300-\u036F\u203F-\u2040'; | |
var ncNameChars = '[' + nameStartCharsExceptColon + | |
'][' + nameCharExceptColon + ']*' | |
// http://www.w3.org/TR/REC-xml-names/#NT-QName | |
var qNameChars = ncNameChars + '(?::' + ncNameChars + ')?'; | |
var otherChars = '\\.\\.|[\\(\\)\\[\\].@,]|::'; // .. must come before [.] | |
var operatorChars = | |
'and|or|mod|div|' + | |
'//|!=|<=|>=|[*/|+\\-=<>]'; // //, !=, <=, >= before individual ones. | |
var literal = '"[^"]*"|' + "'[^']*'"; | |
var numberChars = '[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+'; | |
var variableReference = '\\$' + qNameChars; | |
var nameTestChars = '\\*|' + ncNameChars + ':\\*|' + qNameChars; | |
var optionalSpace = '[ \t\r\n]*'; // stricter than regexp \s. | |
var nodeType = 'comment|text|processing-instruction|node'; | |
var re = new RegExp( | |
// numberChars before otherChars so that leading-decimal doesn't become . | |
'^' + optionalSpace + '(' + numberChars + '|' + otherChars + '|' + | |
nameTestChars + '|' + operatorChars + '|' + literal + '|' + | |
variableReference + ')' | |
// operatorName | nodeType | functionName | axisName are lumped into | |
// qName for now; we'll check them on pop. | |
); | |
Stream.prototype.re = re; | |
Stream.prototype.startsWithNcNameRe = new RegExp('^' + ncNameChars); | |
Stream.prototype.isQnameRe = new RegExp('^' + qNameChars + '$'); | |
Stream.prototype.isNumberRe = new RegExp('^' + numberChars + '$'); | |
})(); | |
/*************************************************************************** | |
* Parsing * | |
***************************************************************************/ | |
var parse = xpath.parse = function parse(stream, a) { | |
var r = orExpr(stream,a); | |
var x, unparsed = []; | |
while (x = stream.pop()) { | |
unparsed.push(x); | |
} | |
if (unparsed.length) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Position ' + stream.position() + | |
': Unparsed tokens: ' + unparsed.join(' ')); | |
return r; | |
} | |
/** | |
* binaryL ::= subExpr | |
* | binaryL op subExpr | |
* so a op b op c becomes ((a op b) op c) | |
*/ | |
function binaryL(subExpr, stream, a, ops) { | |
var lhs = subExpr(stream, a); | |
if (lhs == null) return null; | |
var op; | |
while (op = stream.trypop(ops)) { | |
var rhs = subExpr(stream, a); | |
if (rhs == null) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Position ' + stream.position() + | |
': Expected something after ' + op); | |
lhs = a.node(op, lhs, rhs); | |
} | |
return lhs; | |
} | |
/** | |
* Too bad this is never used. If they made a ** operator (raise to power), | |
( we would use it. | |
* binaryR ::= subExpr | |
* | subExpr op binaryR | |
* so a op b op c becomes (a op (b op c)) | |
*/ | |
function binaryR(subExpr, stream, a, ops) { | |
var lhs = subExpr(stream, a); | |
if (lhs == null) return null; | |
var op = stream.trypop(ops); | |
if (op) { | |
var rhs = binaryR(stream, a); | |
if (rhs == null) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Position ' + stream.position() + | |
': Expected something after ' + op); | |
return a.node(op, lhs, rhs); | |
} else { | |
return lhs;// TODO | |
} | |
} | |
/** [1] LocationPath::= RelativeLocationPath | AbsoluteLocationPath | |
* e.g. a, a/b, //a/b | |
*/ | |
function locationPath(stream, a) { | |
return absoluteLocationPath(stream, a) || | |
relativeLocationPath(null, stream, a); | |
} | |
/** [2] AbsoluteLocationPath::= '/' RelativeLocationPath? | AbbreviatedAbsoluteLocationPath | |
* [10] AbbreviatedAbsoluteLocationPath::= '//' RelativeLocationPath | |
*/ | |
function absoluteLocationPath(stream, a) { | |
var op = stream.peek(); | |
if ('/' === op || '//' === op) { | |
var lhs = a.node('Root'); | |
return relativeLocationPath(lhs, stream, a, true); | |
} else { | |
return null; | |
} | |
} | |
/** [3] RelativeLocationPath::= Step | RelativeLocationPath '/' Step | | |
* | AbbreviatedRelativeLocationPath | |
* [11] AbbreviatedRelativeLocationPath::= RelativeLocationPath '//' Step | |
* e.g. p/a, etc. | |
*/ | |
function relativeLocationPath(lhs, stream, a, isOnlyRootOk) { | |
if (null == lhs) { | |
lhs = step(stream, a); | |
if (null == lhs) return lhs; | |
} | |
var op; | |
while (op = stream.trypop(['/', '//'])) { | |
if ('//' === op) { | |
lhs = a.node('/', lhs, | |
a.node('Axis', 'descendant-or-self', 'node', undefined)); | |
} | |
var rhs = step(stream, a); | |
if (null == rhs && '/' === op && isOnlyRootOk) return lhs; | |
else isOnlyRootOk = false; | |
if (null == rhs) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Position ' + stream.position() + | |
': Expected step after ' + op); | |
lhs = a.node('/', lhs, rhs); | |
} | |
return lhs; | |
} | |
/** [4] Step::= AxisSpecifier NodeTest Predicate* | AbbreviatedStep | |
* [12] AbbreviatedStep::= '.' | '..' | |
* e.g. @href, self::p, p, a[@href], ., .. | |
*/ | |
function step(stream, a) { | |
var abbrStep = stream.trypop(['.', '..']); | |
if ('.' === abbrStep) // A location step of . is short for self::node(). | |
return a.node('Axis', 'self', 'node'); | |
if ('..' === abbrStep) // A location step of .. is short for parent::node() | |
return a.node('Axis', 'parent', 'node'); | |
var axis = axisSpecifier(stream, a); | |
var nodeType = nodeTypeTest(stream, a); | |
var nodeName; | |
if (null == nodeType) nodeName = nodeNameTest(stream, a); | |
if (null == axis && null == nodeType && null == nodeName) return null; | |
if (null == nodeType && null == nodeName) | |
throw new XPathException( | |
XPathException.INVALID_EXPRESSION_ERR, | |
'Position ' + stream.position() + | |
': Expected nodeTest after axisSpecifier ' + axis); | |
if (null == axis) axis = 'child'; | |
if (null == nodeType) { | |
// When there's only a node name, then the node type is forced to be the | |
// principal node type of the axis. | |
// see http://www.w3.org/TR/xpath/#dt-principal-node-type | |
if ('attribute' === axis) nodeType = 'attribute'; | |
else if ('namespace' === axis) nodeType = 'namespace'; | |
else nodeType = 'element'; | |
} | |
var lhs = a.node('Axis', axis, nodeType, nodeName); | |
var pred; | |
while (null != (pred = predicate(lhs, stream, a))) { | |
lhs = pred; | |
} | |
return lhs; | |
} | |
/** [5] AxisSpecifier::= AxisName '::' | AbbreviatedAxisSpecifier | |
* [6] AxisName::= 'ancestor' | 'ancestor-or-self' | 'attribute' | 'child' | |
* | 'descendant' | 'descendant-or-self' | 'following' | |
* | 'following-sibling' | 'namespace' | 'parent' | | |
* | 'preceding' | 'preceding-sibling' | 'self' | |
* [13] AbbreviatedAxisSpecifier::= '@'? | |
*/ | |
function axisSpecifier(stream, a) { | |
var attr = stream.trypop('@'); | |
if (null != attr) return 'attribute'; | |
var axisName = stream.trypopaxisname(); | |
if (null != axisName) { | |
var coloncolon = stream.trypop('::'); | |
if (null == coloncolon) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Position ' + stream.position() + | |
': Should not happen. Should be ::.'); | |
return axisName; | |
} | |
} | |
/** [7] NodeTest::= NameTest | NodeType '(' ')' | 'processing-instruction' '(' Literal ')' | |
* [38] NodeType::= 'comment' | 'text' | 'processing-instruction' | 'node' | |
* I've split nodeTypeTest from nodeNameTest for convenience. | |
*/ | |
function nodeTypeTest(stream, a) { | |
if ('(' !== stream.peek2()) { | |
return null; | |
} | |
var type = stream.trypop(['comment', 'text', 'processing-instruction', 'node']); | |
if (null != type) { | |
if (null == stream.trypop('(')) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Position ' + stream.position() + | |
': Should not happen.'); | |
var param = undefined; | |
if (type == 'processing-instruction') { | |
param = stream.trypopliteral(); | |
} | |
if (null == stream.trypop(')')) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Position ' + stream.position() + | |
': Expected close parens.'); | |
return type | |
} | |
} | |
function nodeNameTest(stream, a) { | |
var name = stream.trypopnametest(); | |
if (name != null) return name; | |
else return null; | |
} | |
/** [8] Predicate::= '[' PredicateExpr ']' | |
* [9] PredicateExpr::= Expr | |
*/ | |
function predicate(lhs, stream, a) { | |
if (null == stream.trypop('[')) return null; | |
var expr = orExpr(stream, a); | |
if (null == expr) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Position ' + stream.position() + | |
': Expected expression after ['); | |
if (null == stream.trypop(']')) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Position ' + stream.position() + | |
': Expected ] after expression.'); | |
return a.node('Predicate', lhs, expr); | |
} | |
/** [14] Expr::= OrExpr | |
*/ | |
/** [15] PrimaryExpr::= VariableReference | '(' Expr ')' | Literal | Number | FunctionCall | |
* e.g. $x, (3+4), "hi", 32, f(x) | |
*/ | |
function primaryExpr(stream, a) { | |
var x = stream.trypopliteral(); | |
if (null == x) | |
x = stream.trypopnumber(); | |
if (null != x) { | |
return x; | |
} | |
var varRef = stream.trypopvarref(); | |
if (null != varRef) return a.node('VariableReference', varRef); | |
var funCall = functionCall(stream, a); | |
if (null != funCall) { | |
return funCall; | |
} | |
if (stream.trypop('(')) { | |
var e = orExpr(stream, a); | |
if (null == e) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Position ' + stream.position() + | |
': Expected expression after (.'); | |
if (null == stream.trypop(')')) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Position ' + stream.position() + | |
': Expected ) after expression.'); | |
return e; | |
} | |
return null; | |
} | |
/** [16] FunctionCall::= FunctionName '(' ( Argument ( ',' Argument )* )? ')' | |
* [17] Argument::= Expr | |
*/ | |
function functionCall(stream, a) { | |
var name = stream.trypopfuncname(stream, a); | |
if (null == name) return null; | |
if (null == stream.trypop('(')) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Position ' + stream.position() + | |
': Expected ( ) after function name.'); | |
var params = []; | |
var first = true; | |
while (null == stream.trypop(')')) { | |
if (!first && null == stream.trypop(',')) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Position ' + stream.position() + | |
': Expected , between arguments of the function.'); | |
first = false; | |
var param = orExpr(stream, a); | |
if (param == null) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Position ' + stream.position() + | |
': Expected expression as argument of function.'); | |
params.push(param); | |
} | |
return a.node('FunctionCall', name, params); | |
} | |
/** [18] UnionExpr::= PathExpr | UnionExpr '|' PathExpr | |
*/ | |
function unionExpr(stream, a) { return binaryL(pathExpr, stream, a, '|'); } | |
/** [19] PathExpr ::= LocationPath | |
* | FilterExpr | |
* | FilterExpr '/' RelativeLocationPath | |
* | FilterExpr '//' RelativeLocationPath | |
* Unlike most other nodes, this one always generates a node because | |
* at this point all reverse nodesets must turn into a forward nodeset | |
*/ | |
function pathExpr(stream, a) { | |
// We have to do FilterExpr before LocationPath because otherwise | |
// LocationPath will eat up the name from a function call. | |
var filter = filterExpr(stream, a); | |
if (null == filter) { | |
var loc = locationPath(stream, a); | |
if (null == loc) { | |
throw new Error | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Position ' + stream.position() + | |
': The expression shouldn\'t be empty...'); | |
} | |
return a.node('PathExpr', loc); | |
} | |
var rel = relativeLocationPath(filter, stream, a, false); | |
if (filter === rel) return rel; | |
else return a.node('PathExpr', rel); | |
} | |
/** [20] FilterExpr::= PrimaryExpr | FilterExpr Predicate | |
* aka. FilterExpr ::= PrimaryExpr Predicate* | |
*/ | |
function filterExpr(stream, a) { | |
var primary = primaryExpr(stream, a); | |
if (primary == null) return null; | |
var pred, lhs = primary; | |
while (null != (pred = predicate(lhs, stream, a))) { | |
lhs = pred; | |
} | |
return lhs; | |
} | |
/** [21] OrExpr::= AndExpr | OrExpr 'or' AndExpr | |
*/ | |
function orExpr(stream, a) { | |
var orig = (stream.peeked || '') + stream.str | |
var r = binaryL(andExpr, stream, a, 'or'); | |
var now = (stream.peeked || '') + stream.str; | |
return r; | |
} | |
/** [22] AndExpr::= EqualityExpr | AndExpr 'and' EqualityExpr | |
*/ | |
function andExpr(stream, a) { return binaryL(equalityExpr, stream, a, 'and'); } | |
/** [23] EqualityExpr::= RelationalExpr | EqualityExpr '=' RelationalExpr | |
* | EqualityExpr '!=' RelationalExpr | |
*/ | |
function equalityExpr(stream, a) { return binaryL(relationalExpr, stream, a, ['=','!=']); } | |
/** [24] RelationalExpr::= AdditiveExpr | RelationalExpr '<' AdditiveExpr | |
* | RelationalExpr '>' AdditiveExpr | |
* | RelationalExpr '<=' AdditiveExpr | |
* | RelationalExpr '>=' AdditiveExpr | |
*/ | |
function relationalExpr(stream, a) { return binaryL(additiveExpr, stream, a, ['<','>','<=','>=']); } | |
/** [25] AdditiveExpr::= MultiplicativeExpr | |
* | AdditiveExpr '+' MultiplicativeExpr | |
* | AdditiveExpr '-' MultiplicativeExpr | |
*/ | |
function additiveExpr(stream, a) { return binaryL(multiplicativeExpr, stream, a, ['+','-']); } | |
/** [26] MultiplicativeExpr::= UnaryExpr | |
* | MultiplicativeExpr MultiplyOperator UnaryExpr | |
* | MultiplicativeExpr 'div' UnaryExpr | |
* | MultiplicativeExpr 'mod' UnaryExpr | |
*/ | |
function multiplicativeExpr(stream, a) { return binaryL(unaryExpr, stream, a, ['*','div','mod']); } | |
/** [27] UnaryExpr::= UnionExpr | '-' UnaryExpr | |
*/ | |
function unaryExpr(stream, a) { | |
if (stream.trypop('-')) { | |
var e = unaryExpr(stream, a); | |
if (null == e) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Position ' + stream.position() + | |
': Expected unary expression after -'); | |
return a.node('UnaryMinus', e); | |
} | |
else return unionExpr(stream, a); | |
} | |
var astFactory = { | |
node: function() {return Array.prototype.slice.call(arguments);} | |
}; | |
/*************************************************************************** | |
* Optimizations (TODO) * | |
***************************************************************************/ | |
/** | |
* Some things I've been considering: | |
* 1) a//b becomes a/descendant::b if there's no predicate that uses | |
* position() or last() | |
* 2) axis[pred]: when pred doesn't use position, evaluate it just once per | |
* node in the node-set rather than once per (node, position, last). | |
* For more optimizations, look up Gecko's optimizer: | |
* http://mxr.mozilla.org/mozilla-central/source/content/xslt/src/xpath/txXPathOptimizer.cpp | |
*/ | |
// TODO | |
function optimize(ast) { | |
} | |
/*************************************************************************** | |
* Evaluation: axes * | |
***************************************************************************/ | |
/** | |
* Data types: For string, number, boolean, we just use Javascript types. | |
* Node-sets have the form | |
* {nodes: [node, ...]} | |
* or {nodes: [node, ...], pos: [[1], [2], ...], lasts: [[1], [2], ...]} | |
* | |
* Most of the time, only the node is used and the position information is | |
* discarded. But if you use a predicate, we need to try every value of | |
* position and last in case the predicate calls position() or last(). | |
*/ | |
/** | |
* The NodeMultiSet is a helper class to help generate | |
* {nodes:[], pos:[], lasts:[]} structures. It is useful for the | |
* descendant, descendant-or-self, following-sibling, and | |
* preceding-sibling axes for which we can use a stack to organize things. | |
*/ | |
function NodeMultiSet(isReverseAxis) { | |
this.nodes = []; | |
this.pos = []; | |
this.lasts = []; | |
this.nextPos = []; | |
this.seriesIndexes = []; // index within nodes that each series begins. | |
this.isReverseAxis = isReverseAxis; | |
this._pushToNodes = isReverseAxis ? Array.prototype.unshift : Array.prototype.push; | |
} | |
NodeMultiSet.prototype = { | |
pushSeries: function pushSeries() { | |
this.nextPos.push(1); | |
this.seriesIndexes.push(this.nodes.length); | |
}, | |
popSeries: function popSeries() { | |
console.assert(0 < this.nextPos.length, this.nextPos); | |
var last = this.nextPos.pop() - 1, | |
indexInPos = this.nextPos.length, | |
seriesBeginIndex = this.seriesIndexes.pop(), | |
seriesEndIndex = this.nodes.length; | |
for (var i = seriesBeginIndex; i < seriesEndIndex; ++i) { | |
console.assert(indexInPos < this.lasts[i].length); | |
console.assert(undefined === this.lasts[i][indexInPos]); | |
this.lasts[i][indexInPos] = last; | |
} | |
}, | |
finalize: function() { | |
if (null == this.nextPos) return this; | |
console.assert(0 === this.nextPos.length); | |
for (var i = 0; i < this.lasts.length; ++i) { | |
for (var j = 0; j < this.lasts[i].length; ++j) { | |
console.assert(null != this.lasts[i][j], i + ',' + j + ':' + JSON.stringify(this.lasts)); | |
} | |
} | |
this.pushSeries = this.popSeries = this.addNode = function() { | |
throw new Error('Already finalized.'); | |
}; | |
return this; | |
}, | |
addNode: function addNode(node) { | |
console.assert(node); | |
this._pushToNodes.call(this.nodes, node) | |
this._pushToNodes.call(this.pos, this.nextPos.slice()); | |
this._pushToNodes.call(this.lasts, new Array(this.nextPos.length)); | |
for (var i = 0; i < this.nextPos.length; ++i) this.nextPos[i]++; | |
}, | |
simplify: function() { | |
this.finalize(); | |
return {nodes:this.nodes, pos:this.pos, lasts:this.lasts}; | |
} | |
}; | |
function eachContext(nodeMultiSet) { | |
var r = []; | |
for (var i = 0; i < nodeMultiSet.nodes.length; i++) { | |
var node = nodeMultiSet.nodes[i]; | |
if (!nodeMultiSet.pos) { | |
r.push({nodes:[node], pos: [[i + 1]], lasts: [[nodeMultiSet.nodes.length]]}); | |
} else { | |
for (var j = 0; j < nodeMultiSet.pos[i].length; ++j) { | |
r.push({nodes:[node], pos: [[nodeMultiSet.pos[i][j]]], lasts: [[nodeMultiSet.lasts[i][j]]]}); | |
} | |
} | |
} | |
return r; | |
} | |
/** Matcher used in the axes. | |
*/ | |
function NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase) { | |
this.nodeTypeNum = nodeTypeNum; | |
this.nodeName = nodeName; | |
this.shouldLowerCase = shouldLowerCase; | |
this.nodeNameTest = | |
null == nodeName ? this._alwaysTrue : | |
shouldLowerCase ? this._nodeNameLowerCaseEquals : | |
this._nodeNameEquals; | |
} | |
NodeMatcher.prototype = { | |
matches: function matches(node) { | |
return (0 === this.nodeTypeNum || node.nodeType === this.nodeTypeNum) && | |
this.nodeNameTest(node.nodeName); | |
}, | |
_alwaysTrue: function(name) {return true;}, | |
_nodeNameEquals: function _nodeNameEquals(name) { | |
return this.nodeName === name; | |
}, | |
_nodeNameLowerCaseEquals: function _nodeNameLowerCaseEquals(name) { | |
return this.nodeName === name.toLowerCase(); | |
} | |
}; | |
function followingSiblingHelper(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase, shift, peek, followingNode, andSelf, isReverseAxis) { | |
var matcher = new NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase); | |
var nodeMultiSet = new NodeMultiSet(isReverseAxis); | |
while (0 < nodeList.length) { // can be if for following, preceding | |
var node = shift.call(nodeList); | |
console.assert(node != null); | |
node = followingNode(node); | |
nodeMultiSet.pushSeries(); | |
var numPushed = 1; | |
while (null != node) { | |
if (! andSelf && matcher.matches(node)) | |
nodeMultiSet.addNode(node); | |
if (node === peek.call(nodeList)) { | |
shift.call(nodeList); | |
nodeMultiSet.pushSeries(); | |
numPushed++; | |
} | |
if (andSelf && matcher.matches(node)) | |
nodeMultiSet.addNode(node); | |
node = followingNode(node); | |
} | |
while (0 < numPushed--) | |
nodeMultiSet.popSeries(); | |
} | |
return nodeMultiSet; | |
} | |
/** Returns the next non-descendant node in document order. | |
* This is the first node in following::node(), if node is the context. | |
*/ | |
function followingNonDescendantNode(node) { | |
if (node.ownerElement) { | |
if (node.ownerElement.firstChild) | |
return node.ownerElement.firstChild; | |
node = node.ownerElement; | |
} | |
do { | |
if (node.nextSibling) return node.nextSibling; | |
} while (node = node.parentNode); | |
return null; | |
} | |
/** Returns the next node in a document-order depth-first search. | |
* See the definition of document order[1]: | |
* 1) element | |
* 2) namespace nodes | |
* 3) attributes | |
* 4) children | |
* [1]: http://www.w3.org/TR/xpath/#dt-document-order | |
*/ | |
function followingNode(node) { | |
if (node.ownerElement) // attributes: following node of element. | |
node = node.ownerElement; | |
if (null != node.firstChild) | |
return node.firstChild; | |
do { | |
if (null != node.nextSibling) { | |
return node.nextSibling; | |
} | |
node = node.parentNode; | |
} while (node); | |
return null; | |
} | |
/** Returns the previous node in document order (excluding attributes | |
* and namespace nodes). | |
*/ | |
function precedingNode(node) { | |
if (node.ownerElement) | |
return node.ownerElement; | |
if (null != node.previousSibling) { | |
node = node.previousSibling; | |
while (null != node.lastChild) { | |
node = node.lastChild; | |
} | |
return node; | |
} | |
if (null != node.parentNode) { | |
return node.parentNode; | |
} | |
return null; | |
} | |
/** This axis is inefficient if there are many nodes in the nodeList. | |
* But I think it's a pretty useless axis so it's ok. */ | |
function followingHelper(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { | |
var matcher = new NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase); | |
var nodeMultiSet = new NodeMultiSet(false); | |
var cursor = nodeList[0]; | |
var unorderedFollowingStarts = []; | |
for (var i = 0; i < nodeList.length; i++) { | |
var node = nodeList[i]; | |
var start = followingNonDescendantNode(node); | |
if (start) | |
unorderedFollowingStarts.push(start); | |
} | |
if (0 === unorderedFollowingStarts.length) | |
return {nodes:[]}; | |
var pos = [], nextPos = []; | |
var started = 0; | |
while (cursor = followingNode(cursor)) { | |
for (var i = unorderedFollowingStarts.length - 1; i >= 0; i--){ | |
if (cursor === unorderedFollowingStarts[i]) { | |
nodeMultiSet.pushSeries(); | |
unorderedFollowingStarts.splice(i,i+1); | |
started++; | |
} | |
} | |
if (started && matcher.matches(cursor)) { | |
nodeMultiSet.addNode(cursor); | |
} | |
} | |
console.assert(0 === unorderedFollowingStarts.length); | |
for (var i = 0; i < started; i++) | |
nodeMultiSet.popSeries(); | |
return nodeMultiSet.finalize(); | |
} | |
function precedingHelper(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { | |
var matcher = new NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase); | |
var cursor = nodeList.pop(); | |
if (null == cursor) return {nodes:{}}; | |
var r = {nodes:[], pos:[], lasts:[]}; | |
var nextParents = [cursor.parentNode || cursor.ownerElement], nextPos = [1]; | |
while (cursor = precedingNode(cursor)) { | |
if (cursor === nodeList[nodeList.length - 1]) { | |
nextParents.push(nodeList.pop()); | |
nextPos.push(1); | |
} | |
var matches = matcher.matches(cursor); | |
var pos, someoneUsed = false; | |
if (matches) | |
pos = nextPos.slice(); | |
for (var i = 0; i < nextParents.length; ++i) { | |
if (cursor === nextParents[i]) { | |
nextParents[i] = cursor.parentNode || cursor.ownerElement; | |
if (matches) { | |
pos[i] = null; | |
} | |
} else { | |
if (matches) { | |
pos[i] = nextPos[i]++; | |
someoneUsed = true; | |
} | |
} | |
} | |
if (someoneUsed) { | |
r.nodes.unshift(cursor); | |
r.pos.unshift(pos); | |
} | |
} | |
for (var i = 0; i < r.pos.length; ++i) { | |
var lasts = []; | |
r.lasts.push(lasts); | |
for (var j = r.pos[i].length - 1; j >= 0; j--) { | |
if (null == r.pos[i][j]) { | |
r.pos[i].splice(j, j+1); | |
} else { | |
lasts.unshift(nextPos[j] - 1); | |
} | |
} | |
} | |
return r; | |
} | |
/** node-set, axis -> node-set */ | |
function descendantDfs(nodeMultiSet, node, remaining, matcher, andSelf, attrIndices, attrNodes) { | |
while (0 < remaining.length && null != remaining[0].ownerElement) { | |
var attr = remaining.shift(); | |
if (andSelf && matcher.matches(attr)) { | |
attrNodes.push(attr); | |
attrIndices.push(nodeMultiSet.nodes.length); | |
} | |
} | |
if (null != node && !andSelf) { | |
if (matcher.matches(node)) | |
nodeMultiSet.addNode(node); | |
} | |
var pushed = false; | |
if (null == node) { | |
if (0 === remaining.length) return; | |
node = remaining.shift(); | |
nodeMultiSet.pushSeries(); | |
pushed = true; | |
} else if (0 < remaining.length && node === remaining[0]) { | |
nodeMultiSet.pushSeries(); | |
pushed = true; | |
remaining.shift(); | |
} | |
if (andSelf) { | |
if (matcher.matches(node)) | |
nodeMultiSet.addNode(node); | |
} | |
// TODO: use optimization. Also try element.getElementsByTagName | |
// var nodeList = 1 === nodeTypeNum && null != node.children ? node.children : node.childNodes; | |
var nodeList = node.childNodes; | |
for (var j = 0; j < nodeList.length; ++j) { | |
var child = nodeList[j]; | |
descendantDfs(nodeMultiSet, child, remaining, matcher, andSelf, attrIndices, attrNodes); | |
} | |
if (pushed) { | |
nodeMultiSet.popSeries(); | |
} | |
} | |
function descenantHelper(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase, andSelf) { | |
var matcher = new NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase); | |
var nodeMultiSet = new NodeMultiSet(false); | |
var attrIndices = [], attrNodes = []; | |
while (0 < nodeList.length) { | |
// var node = nodeList.shift(); | |
descendantDfs(nodeMultiSet, null, nodeList, matcher, andSelf, attrIndices, attrNodes); | |
} | |
nodeMultiSet.finalize(); | |
for (var i = attrNodes.length-1; i >= 0; --i) { | |
nodeMultiSet.nodes.splice(attrIndices[i], attrIndices[i], attrNodes[i]); | |
nodeMultiSet.pos.splice(attrIndices[i], attrIndices[i], [1]); | |
nodeMultiSet.lasts.splice(attrIndices[i], attrIndices[i], [1]); | |
} | |
return nodeMultiSet; | |
} | |
/** | |
*/ | |
function ancestorHelper(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase, andSelf) { | |
var matcher = new NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase); | |
var ancestors = []; // array of non-empty arrays of matching ancestors | |
for (var i = 0; i < nodeList.length; ++i) { | |
var node = nodeList[i]; | |
var isFirst = true; | |
var a = []; | |
while (null != node) { | |
if (!isFirst || andSelf) { | |
if (matcher.matches(node)) | |
a.push(node); | |
} | |
isFirst = false; | |
node = node.parentNode || node.ownerElement; | |
} | |
if (0 < a.length) | |
ancestors.push(a); | |
} | |
var lasts = []; | |
for (var i = 0; i < ancestors.length; ++i) lasts.push(ancestors[i].length); | |
var nodeMultiSet = new NodeMultiSet(true); | |
var newCtx = {nodes:[], pos:[], lasts:[]}; | |
while (0 < ancestors.length) { | |
var pos = [ancestors[0].length]; | |
var last = [lasts[0]]; | |
var node = ancestors[0].pop(); | |
for (var i = ancestors.length - 1; i > 0; --i) { | |
if (node === ancestors[i][ancestors[i].length - 1]) { | |
pos.push(ancestors[i].length); | |
last.push(lasts[i]); | |
ancestors[i].pop(); | |
if (0 === ancestors[i].length) { | |
ancestors.splice(i, i+1); | |
lasts.splice(i, i+1); | |
} | |
} | |
} | |
if (0 === ancestors[0].length) { | |
ancestors.shift(); | |
lasts.shift(); | |
} | |
newCtx.nodes.push(node); | |
newCtx.pos.push(pos); | |
newCtx.lasts.push(last); | |
} | |
return newCtx; | |
} | |
/** Helper function for sortDocumentOrder. Returns a list of indices, from the | |
* node to the root, of positions within parent. | |
* For convenience, the node is the first element of the array. | |
*/ | |
function addressVector(node) { | |
var r = [node]; | |
if (null != node.ownerElement) { | |
node = node.ownerElement; | |
r.push(-1); | |
} | |
while (null != node) { | |
var i = 0; | |
while (null != node.previousSibling) { | |
node = node.previousSibling; | |
i++; | |
} | |
r.push(i); | |
node = node.parentNode | |
} | |
return r; | |
} | |
function addressComparator(a, b) { | |
var minlen = Math.min(a.length - 1, b.length - 1), // not including [0]=node | |
alen = a.length, | |
blen = b.length; | |
if (a[0] === b[0]) return 0; | |
var c; | |
for (var i = 0; i < minlen; ++i) { | |
c = a[alen - i - 1] - b[blen - i - 1]; | |
if (0 !== c) | |
break; | |
} | |
if (null == c || 0 === c) { | |
// All equal until one of the nodes. The longer one is the descendant. | |
c = alen - blen; | |
} | |
if (0 === c) | |
c = a.nodeName - b.nodeName; | |
if (0 === c) | |
c = 1; | |
return c; | |
} | |
var sortUniqDocumentOrder = xpath.sortUniqDocumentOrder = function(nodes) { | |
var a = []; | |
for (var i = 0; i < nodes.length; i++) { | |
var node = nodes[i]; | |
var v = addressVector(node); | |
a.push(v); | |
} | |
a.sort(addressComparator); | |
var b = []; | |
for (var i = 0; i < a.length; i++) { | |
if (0 < i && a[i][0] === a[i - 1][0]) | |
continue; | |
b.push(a[i][0]); | |
} | |
return b; | |
} | |
/** Sort node multiset. Does not do any de-duping. */ | |
function sortNodeMultiSet(nodeMultiSet) { | |
var a = []; | |
for (var i = 0; i < nodeMultiSet.nodes.length; i++) { | |
var v = addressVector(nodeMultiSet.nodes[i]); | |
a.push({v:v, n:nodeMultiSet.nodes[i], | |
p:nodeMultiSet.pos[i], l:nodeMultiSet.lasts[i]}); | |
} | |
a.sort(compare); | |
var r = {nodes:[], pos:[], lasts:[]}; | |
for (var i = 0; i < a.length; ++i) { | |
r.nodes.push(a[i].n); | |
r.pos.push(a[i].p); | |
r.lasts.push(a[i].l); | |
} | |
function compare(x, y) { | |
return addressComparator(x.v, y.v); | |
} | |
return r; | |
} | |
/** Returns an array containing all the ancestors down to a node. | |
* The array starts with document. | |
*/ | |
function nodeAndAncestors(node) { | |
var ancestors = [node]; | |
var p = node; | |
while (p = p.parentNode || p.ownerElement) { | |
ancestors.unshift(p); | |
} | |
return ancestors; | |
} | |
function compareSiblings(a, b) { | |
if (a === b) return 0; | |
var c = a; | |
while (c = c.previousSibling) { | |
if (c === b) | |
return 1; // b < a | |
} | |
c = b; | |
while (c = c.previousSibling) { | |
if (c === a) | |
return -1; // a < b | |
} | |
throw new Error('a and b are not siblings: ' + xpath.stringifyObject(a) + ' vs ' + xpath.stringifyObject(b)); | |
} | |
/** The merge in merge-sort.*/ | |
function mergeNodeLists(x, y) { | |
var a, b, aanc, banc, r = []; | |
if ('object' !== typeof x) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Invalid LHS for | operator ' + | |
'(expected node-set): ' + x); | |
if ('object' !== typeof y) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Invalid LHS for | operator ' + | |
'(expected node-set): ' + y); | |
while (true) { | |
if (null == a) { | |
a = x.shift(); | |
if (null != a) | |
aanc = addressVector(a); | |
} | |
if (null == b) { | |
b = y.shift(); | |
if (null != b) | |
banc = addressVector(b); | |
} | |
if (null == a || null == b) break; | |
var c = addressComparator(aanc, banc); | |
if (c < 0) { | |
r.push(a); | |
a = null; | |
aanc = null; | |
} else if (c > 0) { | |
r.push(b); | |
b = null; | |
banc = null; | |
} else if (a.nodeName < b.nodeName) { // attributes | |
r.push(a); | |
a = null; | |
aanc = null; | |
} else if (a.nodeName > b.nodeName) { // attributes | |
r.push(b); | |
b = null; | |
banc = null; | |
} else if (a !== b) { | |
// choose b arbitrarily | |
r.push(b); | |
b = null; | |
banc = null; | |
} else { | |
console.assert(a === b, c); | |
// just skip b without pushing it. | |
b = null; | |
banc = null; | |
} | |
} | |
while (a) { | |
r.push(a); | |
a = x.shift(); | |
} | |
while (b) { | |
r.push(b); | |
b = y.shift(); | |
} | |
return r; | |
} | |
function comparisonHelper(test, x, y, isNumericComparison) { | |
var coersion; | |
if (isNumericComparison) | |
coersion = fn.number; | |
else coersion = | |
'boolean' === typeof x || 'boolean' === typeof y ? fn['boolean'] : | |
'number' === typeof x || 'number' === typeof y ? fn.number : | |
fn.string; | |
if ('object' === typeof x && 'object' === typeof y) { | |
var aMap = {}; | |
for (var i = 0; i < x.nodes.length; ++i) { | |
var xi = coersion({nodes:[x.nodes[i]]}); | |
for (var j = 0; j < y.nodes.length; ++j) { | |
var yj = coersion({nodes:[y.nodes[j]]}); | |
if (test(xi, yj)) return true; | |
} | |
} | |
return false; | |
} else if ('object' === typeof x && x.nodes && x.nodes.length) { | |
for (var i = 0; i < x.nodes.length; ++i) { | |
var xi = coersion({nodes:[x.nodes[i]]}), yc = coersion(y); | |
if (test(xi, yc)) | |
return true; | |
} | |
return false; | |
} else if ('object' === typeof y && x.nodes && x.nodes.length) { | |
for (var i = 0; i < x.nodes.length; ++i) { | |
var yi = coersion({nodes:[y.nodes[i]]}), xc = coersion(x); | |
if (test(xc, yi)) | |
return true; | |
} | |
return false; | |
} else { | |
var xc = coersion(x), yc = coersion(y); | |
return test(xc, yc); | |
} | |
} | |
var axes = xpath.axes = { | |
'ancestor': | |
function ancestor(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { | |
return ancestorHelper( | |
nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase, false); | |
}, | |
'ancestor-or-self': | |
function ancestorOrSelf(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { | |
return ancestorHelper( | |
nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase, true); | |
}, | |
'attribute': | |
function attribute(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { | |
// TODO: figure out whether positions should be undefined here. | |
var matcher = new NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase); | |
var nodeMultiSet = new NodeMultiSet(false); | |
if (null != nodeName) { | |
// TODO: with namespace | |
for (var i = 0; i < nodeList.length; ++i) { | |
var node = nodeList[i]; | |
if (null == node.getAttributeNode) | |
continue; // only Element has .getAttributeNode | |
var attr = node.getAttributeNode(nodeName); | |
if (null != attr && matcher.matches(attr)) { | |
nodeMultiSet.pushSeries(); | |
nodeMultiSet.addNode(attr); | |
nodeMultiSet.popSeries(); | |
} | |
} | |
} else { | |
for (var i = 0; i < nodeList.length; ++i) { | |
var node = nodeList[i]; | |
if (null != node.attributes) { | |
nodeMultiSet.pushSeries(); | |
for (var j = 0; j < node.attributes.length; j++) { // all nodes have .attributes | |
var attr = node.attributes[j]; | |
if (matcher.matches(attr)) // TODO: I think this check is unnecessary | |
nodeMultiSet.addNode(attr); | |
} | |
nodeMultiSet.popSeries(); | |
} | |
} | |
} | |
return nodeMultiSet.finalize(); | |
}, | |
'child': | |
function child(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { | |
var matcher = new NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase); | |
var nodeMultiSet = new NodeMultiSet(false); | |
for (var i = 0; i < nodeList.length; ++i) { | |
var n = nodeList[i]; | |
if (n.ownerElement) // skip attribute nodes' text child. | |
continue; | |
if (n.childNodes) { | |
nodeMultiSet.pushSeries(); | |
var childList = 1 === nodeTypeNum && null != n.children ? | |
n.children : n.childNodes; | |
for (var j = 0; j < childList.length; ++j) { | |
var child = childList[j]; | |
if (matcher.matches(child)) { | |
nodeMultiSet.addNode(child); | |
} | |
// don't have to do de-duping because children have parent, | |
// which are current context. | |
} | |
nodeMultiSet.popSeries(); | |
} | |
} | |
nodeMultiSet.finalize(); | |
return sortNodeMultiSet(nodeMultiSet); | |
}, | |
'descendant': | |
function descenant(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { | |
return descenantHelper( | |
nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase, false); | |
}, | |
'descendant-or-self': | |
function descenantOrSelf(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { | |
return descenantHelper( | |
nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase, true); | |
}, | |
'following': | |
function following(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { | |
return followingHelper(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase); | |
}, | |
'following-sibling': | |
function followingSibling(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { | |
return followingSiblingHelper( | |
nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase, | |
Array.prototype.shift, function() {return this[0];}, | |
function(node) {return node.nextSibling;}); | |
}, | |
'namespace': | |
function namespace(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { | |
// TODO | |
}, | |
'parent': | |
function parent(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { | |
var matcher = new NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase); | |
var nodes = [], pos = []; | |
for (var i = 0; i < nodeList.length; ++i) { | |
var parent = nodeList[i].parentNode || nodeList[i].ownerElement; | |
if (null == parent) | |
continue; | |
if (!matcher.matches(parent)) | |
continue; | |
if (nodes.length > 0 && parent === nodes[nodes.length-1]) | |
continue; | |
nodes.push(parent); | |
pos.push([1]); | |
} | |
return {nodes:nodes, pos:pos, lasts:pos}; | |
}, | |
'preceding': | |
function preceding(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { | |
return precedingHelper( | |
nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase); | |
}, | |
'preceding-sibling': | |
function precedingSibling(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { | |
return followingSiblingHelper( | |
nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase, | |
Array.prototype.pop, function() {return this[this.length-1];}, | |
function(node) {return node.previousSibling}, | |
false, true); | |
}, | |
'self': | |
function self(nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase) { | |
var nodes = [], pos = []; | |
var matcher = new NodeMatcher(nodeTypeNum, nodeName, shouldLowerCase); | |
for (var i = 0; i < nodeList.length; ++i) { | |
if (matcher.matches(nodeList[i])) { | |
nodes.push(nodeList[i]); | |
pos.push([1]); | |
} | |
} | |
return {nodes: nodes, pos: pos, lasts: pos} | |
} | |
}; | |
/*************************************************************************** | |
* Evaluation: functions * | |
***************************************************************************/ | |
var fn = { | |
'number': function number(optObject) { | |
if ('number' === typeof optObject) | |
return optObject; | |
if ('string' === typeof optObject) | |
return parseFloat(optObject); // note: parseFloat(' ') -> NaN, unlike +' ' -> 0. | |
if ('boolean' === typeof optObject) | |
return +optObject; | |
return fn.number(fn.string.call(this, optObject)); // for node-sets | |
}, | |
'string': function string(optObject) { | |
if (null == optObject) | |
return fn.string(this); | |
if ('string' === typeof optObject || 'boolean' === typeof optObject || | |
'number' === typeof optObject) | |
return '' + optObject; | |
if (0 == optObject.nodes.length) return ''; | |
if (null != optObject.nodes[0].textContent) | |
return optObject.nodes[0].textContent; | |
return optObject.nodes[0].nodeValue; | |
}, | |
'boolean': function booleanVal(x) { | |
return 'object' === typeof x ? x.nodes.length > 0 : !!x; | |
}, | |
'last': function last() { | |
console.assert(Array.isArray(this.pos)); | |
console.assert(Array.isArray(this.lasts)); | |
console.assert(1 === this.pos.length); | |
console.assert(1 === this.lasts.length); | |
console.assert(1 === this.lasts[0].length); | |
return this.lasts[0][0]; | |
}, | |
'position': function position() { | |
console.assert(Array.isArray(this.pos)); | |
console.assert(Array.isArray(this.lasts)); | |
console.assert(1 === this.pos.length); | |
console.assert(1 === this.lasts.length); | |
console.assert(1 === this.pos[0].length); | |
return this.pos[0][0]; | |
}, | |
'count': function count(nodeSet) { | |
if ('object' !== typeof nodeSet) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Position ' + stream.position() + | |
': Function count(node-set) ' + | |
'got wrong argument type: ' + nodeSet); | |
return nodeSet.nodes.length; | |
}, | |
'id': function id(object) { | |
var r = {nodes: []}; | |
var doc = this.nodes[0].ownerDocument || this.nodes[0]; | |
console.assert(doc); | |
var ids; | |
if ('object' === typeof object) { | |
// for node-sets, map id over each node value. | |
ids = []; | |
for (var i = 0; i < object.nodes.length; ++i) { | |
var idNode = object.nodes[i]; | |
var idsString = fn.string({nodes:[idNode]}); | |
var a = idsString.split(/[ \t\r\n]+/g); | |
Array.prototype.push.apply(ids, a); | |
} | |
} else { | |
var idsString = fn.string(object); | |
var a = idsString.split(/[ \t\r\n]+/g); | |
ids = a; | |
} | |
for (var i = 0; i < ids.length; ++i) { | |
var id = ids[i]; | |
if (0 === id.length) | |
continue; | |
var node = doc.getElementById(id); | |
if (null != node) | |
r.nodes.push(node); | |
} | |
r.nodes = sortUniqDocumentOrder(r.nodes); | |
return r; | |
}, | |
'local-name': function(nodeSet) { | |
if (null == nodeSet) | |
return fn.name(this); | |
if (null == nodeSet.nodes) { | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'argument to name() must be a node-set. got ' + nodeSet); | |
} | |
// TODO: namespaced version | |
return nodeSet.nodes[0].nodeName.toLowerCase(); // TODO: no toLowerCase for xml | |
}, | |
'namespace-uri': function(nodeSet) { | |
// TODO | |
throw new Error('not implemented yet'); | |
}, | |
'name': function(nodeSet) { | |
if (null == nodeSet) | |
return fn.name(this); | |
if (null == nodeSet.nodes) { | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'argument to name() must be a node-set. got ' + nodeSet); | |
} | |
return nodeSet.nodes[0].nodeName.toLowerCase(); // TODO: no toLowerCase for xml | |
}, | |
'concat': function concat(x) { | |
var l = []; | |
for (var i = 0; i < arguments.length; ++i) { | |
l.push(fn.string(arguments[i])); | |
} | |
return l.join(''); | |
}, | |
'starts-with': function startsWith(a, b) { | |
var as = fn.string(a), bs = fn.string(b); | |
return as.substr(0, bs.length) === bs; | |
}, | |
'contains': function contains(a, b) { | |
var as = fn.string(a), bs = fn.string(b); | |
var i = as.indexOf(bs); | |
if (-1 === i) return false; | |
return true; | |
}, | |
'substring-before': function substringBefore(a, b) { | |
var as = fn.string(a), bs = fn.string(b); | |
var i = as.indexOf(bs); | |
if (-1 === i) return ''; | |
return as.substr(0, i); | |
}, | |
'substring-after': function substringBefore(a, b) { | |
var as = fn.string(a), bs = fn.string(b); | |
var i = as.indexOf(bs); | |
if (-1 === i) return ''; | |
return as.substr(i + bs.length); | |
}, | |
'substring': function substring(string, start, optEnd) { | |
if (null == string || null == start) { | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Must be at least 2 arguments to string()'); | |
} | |
var sString = fn.string(string), | |
iStart = fn.round(start), | |
iEnd = optEnd == null ? null : fn.round(optEnd); | |
// Note that xpath string positions user 1-based index | |
if (iEnd == null) | |
return sString.substr(iStart - 1); | |
else | |
return sString.substr(iStart - 1, iEnd); | |
}, | |
'string-length': function stringLength(optString) { | |
return fn.string.call(this, optString).length; | |
}, | |
'normalize-space': function normalizeSpace(optString) { | |
var s = fn.string.call(this, optString); | |
return s.replace(/[ \t\r\n]+/g, ' ').replace(/^ | $/g, ''); | |
}, | |
'translate': function translate(string, from, to) { | |
var sString = fn.string.call(this, string), | |
sFrom = fn.string(from), | |
sTo = fn.string(to); | |
var eachCharRe = []; | |
var map = {}; | |
for (var i = 0; i < sFrom.length; ++i) { | |
var c = sFrom.charAt(i); | |
map[c] = sTo.charAt(i); // returns '' if beyond length of sTo. | |
// copied from goog.string.regExpEscape in the Closure library. | |
eachCharRe.push( | |
c.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1'). | |
replace(/\x08/g, '\\x08')); | |
} | |
var re = new RegExp(eachCharRe.join('|'), 'g'); | |
return sString.replace(re, function(c) {return map[c];}); | |
}, | |
/// Boolean functions | |
'not': function not(x) { | |
var bx = fn['boolean'](x); | |
return !bx; | |
}, | |
'true': function trueVal() { return true; }, | |
'false': function falseVal() { return false; }, | |
// TODO | |
'lang': function lang(string) { throw new Error('Not implemented');}, | |
'sum': function sum(optNodeSet) { | |
if (null == optNodeSet) return fn.sum(this); | |
// for node-sets, map id over each node value. | |
var sum = 0; | |
for (var i = 0; i < optNodeSet.nodes.length; ++i) { | |
var node = optNodeSet.nodes[i]; | |
var x = fn.number({nodes:[node]}); | |
sum += x; | |
} | |
return sum; | |
}, | |
'floor': function floor(number) { | |
return Math.floor(fn.number(number)); | |
}, | |
'ceiling': function ceiling(number) { | |
return Math.ceil(fn.number(number)); | |
}, | |
'round': function round(number) { | |
return Math.round(fn.number(number)); | |
} | |
}; | |
/*************************************************************************** | |
* Evaluation: operators * | |
***************************************************************************/ | |
var more = { | |
UnaryMinus: function(x) { return -fn.number(x); }, | |
'+': function(x, y) { return fn.number(x) + fn.number(y); }, | |
'-': function(x, y) { return fn.number(x) - fn.number(y); }, | |
'*': function(x, y) { return fn.number(x) * fn.number(y); }, | |
'div': function(x, y) { return fn.number(x) / fn.number(y); }, | |
'mod': function(x, y) { return fn.number(x) % fn.number(y); }, | |
'<': function(x, y) { | |
return comparisonHelper(function(x, y) { return fn.number(x) < fn.number(y);}, x, y, true); | |
}, | |
'<=': function(x, y) { | |
return comparisonHelper(function(x, y) { return fn.number(x) <= fn.number(y);}, x, y, true); | |
}, | |
'>': function(x, y) { | |
return comparisonHelper(function(x, y) { return fn.number(x) > fn.number(y);}, x, y, true); | |
}, | |
'>=': function(x, y) { | |
return comparisonHelper(function(x, y) { return fn.number(x) >= fn.number(y);}, x, y, true); | |
}, | |
'and': function(x, y) { return fn['boolean'](x) && fn['boolean'](y); }, | |
'or': function(x, y) { return fn['boolean'](x) || fn['boolean'](y); }, | |
'|': function(x, y) { return {nodes: mergeNodeLists(x.nodes, y.nodes)}; }, | |
'=': function(x, y) { | |
// optimization for two node-sets case: avoid n^2 comparisons. | |
if ('object' === typeof x && 'object' === typeof y) { | |
var aMap = {}; | |
for (var i = 0; i < x.nodes.length; ++i) { | |
var s = fn.string({nodes:[x.nodes[i]]}); | |
aMap[s] = true; | |
} | |
for (var i = 0; i < y.nodes.length; ++i) { | |
var s = fn.string({nodes:[y.nodes[i]]}); | |
if (aMap[s]) return true; | |
} | |
return false; | |
} else { | |
return comparisonHelper(function(x, y) {return x === y;}, x, y); | |
} | |
}, | |
'!=': function(x, y) { | |
// optimization for two node-sets case: avoid n^2 comparisons. | |
if ('object' === typeof x && 'object' === typeof y) { | |
if (0 === x.nodes.length || 0 === y.nodes.length) return false; | |
var aMap = {}; | |
for (var i = 0; i < x.nodes.length; ++i) { | |
var s = fn.string({nodes:[x.nodes[i]]}); | |
aMap[s] = true; | |
} | |
for (var i = 0; i < y.nodes.length; ++i) { | |
var s = fn.string({nodes:[y.nodes[i]]}); | |
if (!aMap[s]) return true; | |
} | |
return false; | |
} else { | |
return comparisonHelper(function(x, y) {return x !== y;}, x, y); | |
} | |
} | |
}; | |
var nodeTypes = xpath.nodeTypes = { | |
'node': 0, | |
'attribute': 2, | |
'comment': 8, // this.doc.COMMENT_NODE, | |
'text': 3, // this.doc.TEXT_NODE, | |
'processing-instruction': 7, // this.doc.PROCESSING_INSTRUCTION_NODE, | |
'element': 1 //this.doc.ELEMENT_NODE | |
}; | |
/** For debugging and unit tests: returnjs a stringified version of the | |
* argument. */ | |
var stringifyObject = xpath.stringifyObject = function stringifyObject(ctx) { | |
var seenKey = 'seen' + Math.floor(Math.random()*1000000000); | |
return JSON.stringify(helper(ctx)); | |
function helper(ctx) { | |
if (Array.isArray(ctx)) { | |
return ctx.map(function(x) {return helper(x);}); | |
} | |
if ('object' !== typeof ctx) return ctx; | |
if (null == ctx) return ctx; | |
// if (ctx.toString) return ctx.toString(); | |
if (null != ctx.outerHTML) return ctx.outerHTML; | |
if (null != ctx.nodeValue) return ctx.nodeName + '=' + ctx.nodeValue; | |
if (ctx[seenKey]) return '[circular]'; | |
ctx[seenKey] = true; | |
var nicer = {}; | |
for (var key in ctx) { | |
if (seenKey === key) | |
continue; | |
try { | |
nicer[key] = helper(ctx[key]); | |
} catch (e) { | |
nicer[key] = '[exception: ' + e.message + ']'; | |
} | |
} | |
delete ctx[seenKey]; | |
return nicer; | |
} | |
} | |
var Evaluator = xpath.Evaluator = function Evaluator(doc) { | |
this.doc = doc; | |
} | |
Evaluator.prototype = { | |
val: function val(ast, ctx) { | |
console.assert(ctx.nodes); | |
if ('number' === typeof ast || 'string' === typeof ast) return ast; | |
if (more[ast[0]]) { | |
var evaluatedParams = []; | |
for (var i = 1; i < ast.length; ++i) { | |
evaluatedParams.push(this.val(ast[i], ctx)); | |
} | |
var r = more[ast[0]].apply(ctx, evaluatedParams); | |
return r; | |
} | |
switch (ast[0]) { | |
case 'Root': return {nodes: [this.doc]}; | |
case 'FunctionCall': | |
var functionName = ast[1], functionParams = ast[2]; | |
if (null == fn[functionName]) | |
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, | |
'Unknown function: ' + functionName); | |
var evaluatedParams = []; | |
for (var i = 0; i < functionParams.length; ++i) { | |
evaluatedParams.push(this.val(functionParams[i], ctx)); | |
} | |
var r = fn[functionName].apply(ctx, evaluatedParams); | |
return r; | |
case 'Predicate': | |
var lhs = this.val(ast[1], ctx); | |
var ret = {nodes: []}; | |
var contexts = eachContext(lhs); | |
for (var i = 0; i < contexts.length; ++i) { | |
var singleNodeSet = contexts[i]; | |
var rhs = this.val(ast[2], singleNodeSet); | |
var success; | |
if ('number' === typeof rhs) { | |
success = rhs === singleNodeSet.pos[0][0]; | |
} else { | |
success = fn['boolean'](rhs); | |
} | |
if (success) { | |
var node = singleNodeSet.nodes[0]; | |
ret.nodes.push(node); | |
// skip over all the rest of the same node. | |
while (i+1 < contexts.length && node === contexts[i+1].nodes[0]) { | |
i++; | |
} | |
} | |
} | |
return ret; | |
case 'PathExpr': | |
// turn the path into an expressoin; i.e., remove the position | |
// information of the last axis. | |
var x = this.val(ast[1], ctx); | |
// Make the nodeset a forward-direction-only one. | |
if (x.finalize) { // it is a NodeMultiSet | |
for (var i = 0; i < x.nodes.length; ++i) { | |
console.assert(null != x.nodes[i].nodeType); | |
} | |
return {nodes: x.nodes}; | |
} else { | |
return x; | |
} | |
case '/': | |
// TODO: don't generate '/' nodes, just Axis nodes. | |
var lhs = this.val(ast[1], ctx); | |
console.assert(null != lhs); | |
var r = this.val(ast[2], lhs); | |
console.assert(null != r); | |
return r; | |
case 'Axis': | |
// All the axis tests from Step. We only get AxisSpecifier NodeTest, | |
// not the predicate (which is applied later) | |
var axis = ast[1], | |
nodeType = ast[2], | |
nodeTypeNum = nodeTypes[nodeType], | |
shouldLowerCase = true, // TODO: give option | |
nodeName = ast[3] && shouldLowerCase ? ast[3].toLowerCase() : ast[3]; | |
nodeName = nodeName === '*' ? null : nodeName; | |
if ('object' !== typeof ctx) return {nodes:[], pos:[]}; | |
var nodeList = ctx.nodes.slice(); // TODO: is copy needed? | |
var r = axes[axis](nodeList /*destructive!*/, nodeTypeNum, nodeName, shouldLowerCase); | |
return r; | |
} | |
} | |
}; | |
var evaluate = xpath.evaluate = function evaluate(expr, doc, context) { | |
//var astFactory = new AstEvaluatorFactory(doc, context); | |
var stream = new Stream(expr); | |
var ast = parse(stream, astFactory); | |
var val = new Evaluator(doc).val(ast, {nodes: [context]}); | |
return val; | |
} | |
/*************************************************************************** | |
* DOM interface * | |
***************************************************************************/ | |
var XPathException = xpath.XPathException = function XPathException(code, message) { | |
var e = new Error(message); | |
e.name = 'XPathException'; | |
e.code = code; | |
return e; | |
} | |
XPathException.INVALID_EXPRESSION_ERR = 51; | |
XPathException.TYPE_ERR = 52; | |
var XPathEvaluator = xpath.XPathEvaluator = function XPathEvaluator() {} | |
XPathEvaluator.prototype = { | |
createExpression: function(expression, resolver) { | |
return new XPathExpression(expression, resolver); | |
}, | |
createNSResolver: function(nodeResolver) { | |
// TODO | |
}, | |
evaluate: function evaluate(expression, contextNode, resolver, type, result) { | |
var expr = new XPathExpression(expression, resolver); | |
return expr.evaluate(contextNode, type, result); | |
} | |
}; | |
var XPathExpression = xpath.XPathExpression = function XPathExpression(expression, resolver, optDoc) { | |
var stream = new Stream(expression); | |
this._ast = parse(stream, astFactory); | |
this._doc = optDoc; | |
} | |
XPathExpression.prototype = { | |
evaluate: function evaluate(contextNode, type, result) { | |
if (null == contextNode.nodeType) | |
throw new Error('bad argument (expected context node): ' + contextNode); | |
var doc = contextNode.ownerDocument || contextNode; | |
if (null != this._doc && this._doc !== doc) { | |
throw new core.DOMException( | |
core.WRONG_DOCUMENT_ERR, | |
'The document must be the same as the context node\'s document.'); | |
} | |
var evaluator = new Evaluator(doc); | |
var value = evaluator.val(this._ast, {nodes: [contextNode]}); | |
if (XPathResult.NUMBER_TYPE === type) | |
value = fn.number(value); | |
else if (XPathResult.STRING_TYPE === type) | |
value = fn.string(value); | |
else if (XPathResult.BOOLEAN_TYPE === type) | |
value = fn['boolean'](value); | |
else if (XPathResult.ANY_TYPE !== type && | |
XPathResult.UNORDERED_NODE_ITERATOR_TYPE !== type && | |
XPathResult.ORDERED_NODE_ITERATOR_TYPE !== type && | |
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE !== type && | |
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE !== type && | |
XPathResult.ANY_UNORDERED_NODE_TYPE !== type && | |
XPathResult.FIRST_ORDERED_NODE_TYPE !== type) | |
throw new core.DOMException( | |
core.NOT_SUPPORTED_ERR, | |
'You must provide an XPath result type (0=any).'); | |
else if (XPathResult.ANY_TYPE !== type && | |
'object' !== typeof value) | |
throw new XPathException( | |
XPathException.TYPE_ERR, | |
'Value should be a node-set: ' + value); | |
return new XPathResult(doc, value, type); | |
} | |
} | |
var XPathResult = xpath.XPathResult = function XPathResult(doc, value, resultType) { | |
this._value = value; | |
this._resultType = resultType; | |
this._i = 0; | |
this._invalidated = false; | |
if (this.resultType === XPathResult.UNORDERED_NODE_ITERATOR_TYPE || | |
this.resultType === XPathResult.ORDERED_NODE_ITERATOR_TYPE) { | |
doc.addEventListener('DOMSubtreeModified', invalidate, true); | |
var self = this; | |
function invalidate() { | |
self._invalidated = true; | |
doc.removeEventListener('DOMSubtreeModified', invalidate, true); | |
} | |
} | |
} | |
XPathResult.ANY_TYPE = 0; | |
XPathResult.NUMBER_TYPE = 1; | |
XPathResult.STRING_TYPE = 2; | |
XPathResult.BOOLEAN_TYPE = 3; | |
XPathResult.UNORDERED_NODE_ITERATOR_TYPE = 4; | |
XPathResult.ORDERED_NODE_ITERATOR_TYPE = 5; | |
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE = 6; | |
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE = 7; | |
XPathResult.ANY_UNORDERED_NODE_TYPE = 8; | |
XPathResult.FIRST_ORDERED_NODE_TYPE = 9; | |
var proto = { | |
// XPathResultType | |
get resultType() { | |
if (this._resultType) return this._resultType; | |
switch (typeof this._value) { | |
case 'number': return XPathResult.NUMBER_TYPE; | |
case 'string': return XPathResult.STRING_TYPE; | |
case 'boolean': return XPathResult.BOOLEAN_TYPE; | |
default: return XPathResult.UNORDERED_NODE_ITERATOR_TYPE; | |
} | |
}, | |
get numberValue() { | |
if (XPathResult.NUMBER_TYPE !== this.resultType) | |
throw new XPathException(XPathException.TYPE_ERR, | |
'You should have asked for a NUMBER_TYPE.'); | |
return this._value; | |
}, | |
get stringValue() { | |
if (XPathResult.STRING_TYPE !== this.resultType) | |
throw new XPathException(XPathException.TYPE_ERR, | |
'You should have asked for a STRING_TYPE.'); | |
return this._value; | |
}, | |
get booleanValue() { | |
if (XPathResult.BOOLEAN_TYPE !== this.resultType) | |
throw new XPathException(XPathException.TYPE_ERR, | |
'You should have asked for a BOOLEAN_TYPE.'); | |
return this._value; | |
}, | |
get singleNodeValue() { | |
if (XPathResult.ANY_UNORDERED_NODE_TYPE !== this.resultType && | |
XPathResult.FIRST_ORDERED_NODE_TYPE !== this.resultType) | |
throw new XPathException( | |
XPathException.TYPE_ERR, | |
'You should have asked for a FIRST_ORDERED_NODE_TYPE.'); | |
return this._value.nodes[0] || null; | |
}, | |
get invalidIteratorState() { | |
if (XPathResult.UNORDERED_NODE_ITERATOR_TYPE !== this.resultType && | |
XPathResult.ORDERED_NODE_ITERATOR_TYPE !== this.resultType) | |
return false; | |
return !!this._invalidated; | |
}, | |
get snapshotLength() { | |
if (XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE !== this.resultType && | |
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE !== this.resultType) | |
throw new XPathException( | |
XPathException.TYPE_ERR, | |
'You should have asked for a ORDERED_NODE_SNAPSHOT_TYPE.'); | |
return this._value.nodes.length; | |
}, | |
iterateNext: function iterateNext() { | |
if (XPathResult.UNORDERED_NODE_ITERATOR_TYPE !== this.resultType && | |
XPathResult.ORDERED_NODE_ITERATOR_TYPE !== this.resultType) | |
throw new XPathException( | |
XPathException.TYPE_ERR, | |
'You should have asked for a ORDERED_NODE_ITERATOR_TYPE.'); | |
if (this.invalidIteratorState) | |
throw new core.DOMException( | |
core.INVALID_STATE_ERR, | |
'The document has been mutated since the result was returned'); | |
return this._value.nodes[this._i++] || null; | |
}, | |
snapshotItem: function snapshotItem(index) { | |
if (XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE !== this.resultType && | |
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE !== this.resultType) | |
throw new XPathException( | |
XPathException.TYPE_ERR, | |
'You should have asked for a ORDERED_NODE_SNAPSHOT_TYPE.'); | |
return this._value.nodes[index] || null; | |
} | |
}; | |
// so you can access ANY_TYPE etc. from the instances: | |
XPathResult.prototype = Object.create(XPathResult, | |
Object.keys(proto).reduce(function (descriptors, name) { | |
descriptors[name] = Object.getOwnPropertyDescriptor(proto, name); | |
return descriptors; | |
}, { | |
constructor: { | |
value: XPathResult, | |
writable: true, | |
configurable: true | |
} | |
})); | |
core.XPathException = XPathException; | |
core.XPathExpression = XPathExpression; | |
core.XPathResult = XPathResult; | |
core.XPathEvaluator = XPathEvaluator; | |
core.Document.prototype.createExpression = | |
XPathEvaluator.prototype.createExpression; | |
core.Document.prototype.createNSResolver = | |
XPathEvaluator.prototype.createNSResolver; | |
core.Document.prototype.evaluate = XPathEvaluator.prototype.evaluate; | |
})(); | |
/***/ }, | |
/* 37 */ | |
/*!*****************************************************************!*\ | |
!*** (webpack)/~/node-libs-browser/~/https-browserify/index.js ***! | |
\*****************************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var http = __webpack_require__(/*! http */ 28); | |
var https = module.exports; | |
for (var key in http) { | |
if (http.hasOwnProperty(key)) https[key] = http[key]; | |
}; | |
https.request = function (params, cb) { | |
if (!params) params = {}; | |
params.scheme = 'https'; | |
return http.request.call(this, params, cb); | |
} | |
/***/ }, | |
/* 38 */ | |
/*!********************************************************!*\ | |
!*** (webpack)/~/node-libs-browser/~/assert/assert.js ***! | |
\********************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 | |
// | |
// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! | |
// | |
// Originally from narwhal.js (http://narwhaljs.org) | |
// Copyright (c) 2009 Thomas Robinson <280north.com> | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the 'Software'), to | |
// deal in the Software without restriction, including without limitation the | |
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |
// sell copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included in | |
// all copies or substantial portions of the Software. | |
// | |
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | |
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
// when used in node, this will actually load the util module we depend on | |
// versus loading the builtin util module as happens otherwise | |
// this is a bug in node module loading as far as I am concerned | |
var util = __webpack_require__(/*! util/ */ 70); | |
var pSlice = Array.prototype.slice; | |
var hasOwn = Object.prototype.hasOwnProperty; | |
// 1. The assert module provides functions that throw | |
// AssertionError's when particular conditions are not met. The | |
// assert module must conform to the following interface. | |
var assert = module.exports = ok; | |
// 2. The AssertionError is defined in assert. | |
// new assert.AssertionError({ message: message, | |
// actual: actual, | |
// expected: expected }) | |
assert.AssertionError = function AssertionError(options) { | |
this.name = 'AssertionError'; | |
this.actual = options.actual; | |
this.expected = options.expected; | |
this.operator = options.operator; | |
if (options.message) { | |
this.message = options.message; | |
this.generatedMessage = false; | |
} else { | |
this.message = getMessage(this); | |
this.generatedMessage = true; | |
} | |
var stackStartFunction = options.stackStartFunction || fail; | |
if (Error.captureStackTrace) { | |
Error.captureStackTrace(this, stackStartFunction); | |
} | |
else { | |
// non v8 browsers so we can have a stacktrace | |
var err = new Error(); | |
if (err.stack) { | |
var out = err.stack; | |
// try to strip useless frames | |
var fn_name = stackStartFunction.name; | |
var idx = out.indexOf('\n' + fn_name); | |
if (idx >= 0) { | |
// once we have located the function frame | |
// we need to strip out everything before it (and its line) | |
var next_line = out.indexOf('\n', idx + 1); | |
out = out.substring(next_line + 1); | |
} | |
this.stack = out; | |
} | |
} | |
}; | |
// assert.AssertionError instanceof Error | |
util.inherits(assert.AssertionError, Error); | |
function replacer(key, value) { | |
if (util.isUndefined(value)) { | |
return '' + value; | |
} | |
if (util.isNumber(value) && (isNaN(value) || !isFinite(value))) { | |
return value.toString(); | |
} | |
if (util.isFunction(value) || util.isRegExp(value)) { | |
return value.toString(); | |
} | |
return value; | |
} | |
function truncate(s, n) { | |
if (util.isString(s)) { | |
return s.length < n ? s : s.slice(0, n); | |
} else { | |
return s; | |
} | |
} | |
function getMessage(self) { | |
return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' + | |
self.operator + ' ' + | |
truncate(JSON.stringify(self.expected, replacer), 128); | |
} | |
// At present only the three keys mentioned above are used and | |
// understood by the spec. Implementations or sub modules can pass | |
// other keys to the AssertionError's constructor - they will be | |
// ignored. | |
// 3. All of the following functions must throw an AssertionError | |
// when a corresponding condition is not met, with a message that | |
// may be undefined if not provided. All assertion methods provide | |
// both the actual and expected values to the assertion error for | |
// display purposes. | |
function fail(actual, expected, message, operator, stackStartFunction) { | |
throw new assert.AssertionError({ | |
message: message, | |
actual: actual, | |
expected: expected, | |
operator: operator, | |
stackStartFunction: stackStartFunction | |
}); | |
} | |
// EXTENSION! allows for well behaved errors defined elsewhere. | |
assert.fail = fail; | |
// 4. Pure assertion tests whether a value is truthy, as determined | |
// by !!guard. | |
// assert.ok(guard, message_opt); | |
// This statement is equivalent to assert.equal(true, !!guard, | |
// message_opt);. To test strictly for the value true, use | |
// assert.strictEqual(true, guard, message_opt);. | |
function ok(value, message) { | |
if (!value) fail(value, true, message, '==', assert.ok); | |
} | |
assert.ok = ok; | |
// 5. The equality assertion tests shallow, coercive equality with | |
// ==. | |
// assert.equal(actual, expected, message_opt); | |
assert.equal = function equal(actual, expected, message) { | |
if (actual != expected) fail(actual, expected, message, '==', assert.equal); | |
}; | |
// 6. The non-equality assertion tests for whether two objects are not equal | |
// with != assert.notEqual(actual, expected, message_opt); | |
assert.notEqual = function notEqual(actual, expected, message) { | |
if (actual == expected) { | |
fail(actual, expected, message, '!=', assert.notEqual); | |
} | |
}; | |
// 7. The equivalence assertion tests a deep equality relation. | |
// assert.deepEqual(actual, expected, message_opt); | |
assert.deepEqual = function deepEqual(actual, expected, message) { | |
if (!_deepEqual(actual, expected)) { | |
fail(actual, expected, message, 'deepEqual', assert.deepEqual); | |
} | |
}; | |
function _deepEqual(actual, expected) { | |
// 7.1. All identical values are equivalent, as determined by ===. | |
if (actual === expected) { | |
return true; | |
} else if (util.isBuffer(actual) && util.isBuffer(expected)) { | |
if (actual.length != expected.length) return false; | |
for (var i = 0; i < actual.length; i++) { | |
if (actual[i] !== expected[i]) return false; | |
} | |
return true; | |
// 7.2. If the expected value is a Date object, the actual value is | |
// equivalent if it is also a Date object that refers to the same time. | |
} else if (util.isDate(actual) && util.isDate(expected)) { | |
return actual.getTime() === expected.getTime(); | |
// 7.3 If the expected value is a RegExp object, the actual value is | |
// equivalent if it is also a RegExp object with the same source and | |
// properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). | |
} else if (util.isRegExp(actual) && util.isRegExp(expected)) { | |
return actual.source === expected.source && | |
actual.global === expected.global && | |
actual.multiline === expected.multiline && | |
actual.lastIndex === expected.lastIndex && | |
actual.ignoreCase === expected.ignoreCase; | |
// 7.4. Other pairs that do not both pass typeof value == 'object', | |
// equivalence is determined by ==. | |
} else if (!util.isObject(actual) && !util.isObject(expected)) { | |
return actual == expected; | |
// 7.5 For all other Object pairs, including Array objects, equivalence is | |
// determined by having the same number of owned properties (as verified | |
// with Object.prototype.hasOwnProperty.call), the same set of keys | |
// (although not necessarily the same order), equivalent values for every | |
// corresponding key, and an identical 'prototype' property. Note: this | |
// accounts for both named and indexed properties on Arrays. | |
} else { | |
return objEquiv(actual, expected); | |
} | |
} | |
function isArguments(object) { | |
return Object.prototype.toString.call(object) == '[object Arguments]'; | |
} | |
function objEquiv(a, b) { | |
if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b)) | |
return false; | |
// an identical 'prototype' property. | |
if (a.prototype !== b.prototype) return false; | |
//~~~I've managed to break Object.keys through screwy arguments passing. | |
// Converting to array solves the problem. | |
if (isArguments(a)) { | |
if (!isArguments(b)) { | |
return false; | |
} | |
a = pSlice.call(a); | |
b = pSlice.call(b); | |
return _deepEqual(a, b); | |
} | |
try { | |
var ka = objectKeys(a), | |
kb = objectKeys(b), | |
key, i; | |
} catch (e) {//happens when one is a string literal and the other isn't | |
return false; | |
} | |
// having the same number of owned properties (keys incorporates | |
// hasOwnProperty) | |
if (ka.length != kb.length) | |
return false; | |
//the same set of keys (although not necessarily the same order), | |
ka.sort(); | |
kb.sort(); | |
//~~~cheap key test | |
for (i = ka.length - 1; i >= 0; i--) { | |
if (ka[i] != kb[i]) | |
return false; | |
} | |
//equivalent values for every corresponding key, and | |
//~~~possibly expensive deep test | |
for (i = ka.length - 1; i >= 0; i--) { | |
key = ka[i]; | |
if (!_deepEqual(a[key], b[key])) return false; | |
} | |
return true; | |
} | |
// 8. The non-equivalence assertion tests for any deep inequality. | |
// assert.notDeepEqual(actual, expected, message_opt); | |
assert.notDeepEqual = function notDeepEqual(actual, expected, message) { | |
if (_deepEqual(actual, expected)) { | |
fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); | |
} | |
}; | |
// 9. The strict equality assertion tests strict equality, as determined by ===. | |
// assert.strictEqual(actual, expected, message_opt); | |
assert.strictEqual = function strictEqual(actual, expected, message) { | |
if (actual !== expected) { | |
fail(actual, expected, message, '===', assert.strictEqual); | |
} | |
}; | |
// 10. The strict non-equality assertion tests for strict inequality, as | |
// determined by !==. assert.notStrictEqual(actual, expected, message_opt); | |
assert.notStrictEqual = function notStrictEqual(actual, expected, message) { | |
if (actual === expected) { | |
fail(actual, expected, message, '!==', assert.notStrictEqual); | |
} | |
}; | |
function expectedException(actual, expected) { | |
if (!actual || !expected) { | |
return false; | |
} | |
if (Object.prototype.toString.call(expected) == '[object RegExp]') { | |
return expected.test(actual); | |
} else if (actual instanceof expected) { | |
return true; | |
} else if (expected.call({}, actual) === true) { | |
return true; | |
} | |
return false; | |
} | |
function _throws(shouldThrow, block, expected, message) { | |
var actual; | |
if (util.isString(expected)) { | |
message = expected; | |
expected = null; | |
} | |
try { | |
block(); | |
} catch (e) { | |
actual = e; | |
} | |
message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + | |
(message ? ' ' + message : '.'); | |
if (shouldThrow && !actual) { | |
fail(actual, expected, 'Missing expected exception' + message); | |
} | |
if (!shouldThrow && expectedException(actual, expected)) { | |
fail(actual, expected, 'Got unwanted exception' + message); | |
} | |
if ((shouldThrow && actual && expected && | |
!expectedException(actual, expected)) || (!shouldThrow && actual)) { | |
throw actual; | |
} | |
} | |
// 11. Expected to throw an error: | |
// assert.throws(block, Error_opt, message_opt); | |
assert.throws = function(block, /*optional*/error, /*optional*/message) { | |
_throws.apply(this, [true].concat(pSlice.call(arguments))); | |
}; | |
// EXTENSION! This is annoying to write outside this module. | |
assert.doesNotThrow = function(block, /*optional*/message) { | |
_throws.apply(this, [false].concat(pSlice.call(arguments))); | |
}; | |
assert.ifError = function(err) { if (err) {throw err;}}; | |
var objectKeys = Object.keys || function (obj) { | |
var keys = []; | |
for (var key in obj) { | |
if (hasOwn.call(obj, key)) keys.push(key); | |
} | |
return keys; | |
}; | |
/***/ }, | |
/* 39 */ | |
/*!***********************************!*\ | |
!*** ./~/jsdom/~/parse5/index.js ***! | |
\***********************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
exports.Parser = __webpack_require__(/*! ./lib/tree_construction/parser */ 63); | |
exports.SimpleApiParser = __webpack_require__(/*! ./lib/simple_api/simple_api_parser */ 64); | |
exports.TreeSerializer = __webpack_require__(/*! ./lib/tree_serialization/tree_serializer */ 65); | |
exports.TreeAdapters = { | |
default: __webpack_require__(/*! ./lib/tree_adapters/default */ 66), | |
htmlparser2: __webpack_require__(/*! ./lib/tree_adapters/htmlparser2 */ 67) | |
}; | |
/***/ }, | |
/* 40 */ | |
/*!**************************************!*\ | |
!*** ./~/jsdom/~/cssom/lib/index.js ***! | |
\**************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
'use strict'; | |
exports.CSSStyleDeclaration = __webpack_require__(/*! ./CSSStyleDeclaration */ 46).CSSStyleDeclaration; | |
exports.CSSRule = __webpack_require__(/*! ./CSSRule */ 47).CSSRule; | |
exports.CSSStyleRule = __webpack_require__(/*! ./CSSStyleRule */ 48).CSSStyleRule; | |
exports.MediaList = __webpack_require__(/*! ./MediaList */ 49).MediaList; | |
exports.CSSMediaRule = __webpack_require__(/*! ./CSSMediaRule */ 50).CSSMediaRule; | |
exports.CSSImportRule = __webpack_require__(/*! ./CSSImportRule */ 51).CSSImportRule; | |
exports.CSSFontFaceRule = __webpack_require__(/*! ./CSSFontFaceRule */ 52).CSSFontFaceRule; | |
exports.StyleSheet = __webpack_require__(/*! ./StyleSheet */ 53).StyleSheet; | |
exports.CSSStyleSheet = __webpack_require__(/*! ./CSSStyleSheet */ 54).CSSStyleSheet; | |
exports.CSSKeyframesRule = __webpack_require__(/*! ./CSSKeyframesRule */ 55).CSSKeyframesRule; | |
exports.CSSKeyframeRule = __webpack_require__(/*! ./CSSKeyframeRule */ 56).CSSKeyframeRule; | |
exports.MatcherList = __webpack_require__(/*! ./MatcherList */ 57).MatcherList; | |
exports.CSSDocumentRule = __webpack_require__(/*! ./CSSDocumentRule */ 58).CSSDocumentRule; | |
exports.CSSValue = __webpack_require__(/*! ./CSSValue */ 59).CSSValue; | |
exports.CSSValueExpression = __webpack_require__(/*! ./CSSValueExpression */ 60).CSSValueExpression; | |
exports.parse = __webpack_require__(/*! ./parse */ 61).parse; | |
exports.clone = __webpack_require__(/*! ./clone */ 62).clone; | |
/***/ }, | |
/* 41 */ | |
/*!********************************************************!*\ | |
!*** ./~/jsdom/~/xmlhttprequest/lib/XMLHttpRequest.js ***! | |
\********************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(Buffer, process) {/** | |
* Wrapper for built-in http.js to emulate the browser XMLHttpRequest object. | |
* | |
* This can be used with JS designed for browsers to improve reuse of code and | |
* allow the use of existing libraries. | |
* | |
* Usage: include("XMLHttpRequest.js") and use XMLHttpRequest per W3C specs. | |
* | |
* @author Dan DeFelippi <[email protected]> | |
* @contributor David Ellis <[email protected]> | |
* @license MIT | |
*/ | |
var Url = __webpack_require__(/*! url */ 11) | |
, spawn = __webpack_require__(/*! child_process */ 14).spawn | |
, fs = __webpack_require__(/*! fs */ 14); | |
exports.XMLHttpRequest = function() { | |
/** | |
* Private variables | |
*/ | |
var self = this; | |
var http = __webpack_require__(/*! http */ 28); | |
var https = __webpack_require__(/*! https */ 37); | |
// Holds http.js objects | |
var request; | |
var response; | |
// Request settings | |
var settings = {}; | |
// Disable header blacklist. | |
// Not part of XHR specs. | |
var disableHeaderCheck = false; | |
// Set some default headers | |
var defaultHeaders = { | |
"User-Agent": "node-XMLHttpRequest", | |
"Accept": "*/*", | |
}; | |
var headers = defaultHeaders; | |
// These headers are not user setable. | |
// The following are allowed but banned in the spec: | |
// * user-agent | |
var forbiddenRequestHeaders = [ | |
"accept-charset", | |
"accept-encoding", | |
"access-control-request-headers", | |
"access-control-request-method", | |
"connection", | |
"content-length", | |
"content-transfer-encoding", | |
"cookie", | |
"cookie2", | |
"date", | |
"expect", | |
"host", | |
"keep-alive", | |
"origin", | |
"referer", | |
"te", | |
"trailer", | |
"transfer-encoding", | |
"upgrade", | |
"via" | |
]; | |
// These request methods are not allowed | |
var forbiddenRequestMethods = [ | |
"TRACE", | |
"TRACK", | |
"CONNECT" | |
]; | |
// Send flag | |
var sendFlag = false; | |
// Error flag, used when errors occur or abort is called | |
var errorFlag = false; | |
// Event listeners | |
var listeners = {}; | |
/** | |
* Constants | |
*/ | |
this.UNSENT = 0; | |
this.OPENED = 1; | |
this.HEADERS_RECEIVED = 2; | |
this.LOADING = 3; | |
this.DONE = 4; | |
/** | |
* Public vars | |
*/ | |
// Current state | |
this.readyState = this.UNSENT; | |
// default ready state change handler in case one is not set or is set late | |
this.onreadystatechange = null; | |
// Result & response | |
this.responseText = ""; | |
this.responseXML = ""; | |
this.status = null; | |
this.statusText = null; | |
/** | |
* Private methods | |
*/ | |
/** | |
* Check if the specified header is allowed. | |
* | |
* @param string header Header to validate | |
* @return boolean False if not allowed, otherwise true | |
*/ | |
var isAllowedHttpHeader = function(header) { | |
return disableHeaderCheck || (header && forbiddenRequestHeaders.indexOf(header.toLowerCase()) === -1); | |
}; | |
/** | |
* Check if the specified method is allowed. | |
* | |
* @param string method Request method to validate | |
* @return boolean False if not allowed, otherwise true | |
*/ | |
var isAllowedHttpMethod = function(method) { | |
return (method && forbiddenRequestMethods.indexOf(method) === -1); | |
}; | |
/** | |
* Public methods | |
*/ | |
/** | |
* Open the connection. Currently supports local server requests. | |
* | |
* @param string method Connection method (eg GET, POST) | |
* @param string url URL for the connection. | |
* @param boolean async Asynchronous connection. Default is true. | |
* @param string user Username for basic authentication (optional) | |
* @param string password Password for basic authentication (optional) | |
*/ | |
this.open = function(method, url, async, user, password) { | |
this.abort(); | |
errorFlag = false; | |
// Check for valid request method | |
if (!isAllowedHttpMethod(method)) { | |
throw "SecurityError: Request method not allowed"; | |
} | |
settings = { | |
"method": method, | |
"url": url.toString(), | |
"async": (typeof async !== "boolean" ? true : async), | |
"user": user || null, | |
"password": password || null | |
}; | |
setState(this.OPENED); | |
}; | |
/** | |
* Disables or enables isAllowedHttpHeader() check the request. Enabled by default. | |
* This does not conform to the W3C spec. | |
* | |
* @param boolean state Enable or disable header checking. | |
*/ | |
this.setDisableHeaderCheck = function(state) { | |
disableHeaderCheck = state; | |
}; | |
/** | |
* Sets a header for the request. | |
* | |
* @param string header Header name | |
* @param string value Header value | |
*/ | |
this.setRequestHeader = function(header, value) { | |
if (this.readyState != this.OPENED) { | |
throw "INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN"; | |
} | |
if (!isAllowedHttpHeader(header)) { | |
console.warn('Refused to set unsafe header "' + header + '"'); | |
return; | |
} | |
if (sendFlag) { | |
throw "INVALID_STATE_ERR: send flag is true"; | |
} | |
headers[header] = value; | |
}; | |
/** | |
* Gets a header from the server response. | |
* | |
* @param string header Name of header to get. | |
* @return string Text of the header or null if it doesn't exist. | |
*/ | |
this.getResponseHeader = function(header) { | |
if (typeof header === "string" | |
&& this.readyState > this.OPENED | |
&& response.headers[header.toLowerCase()] | |
&& !errorFlag | |
) { | |
return response.headers[header.toLowerCase()]; | |
} | |
return null; | |
}; | |
/** | |
* Gets all the response headers. | |
* | |
* @return string A string with all response headers separated by CR+LF | |
*/ | |
this.getAllResponseHeaders = function() { | |
if (this.readyState < this.HEADERS_RECEIVED || errorFlag) { | |
return ""; | |
} | |
var result = ""; | |
for (var i in response.headers) { | |
// Cookie headers are excluded | |
if (i !== "set-cookie" && i !== "set-cookie2") { | |
result += i + ": " + response.headers[i] + "\r\n"; | |
} | |
} | |
return result.substr(0, result.length - 2); | |
}; | |
/** | |
* Gets a request header | |
* | |
* @param string name Name of header to get | |
* @return string Returns the request header or empty string if not set | |
*/ | |
this.getRequestHeader = function(name) { | |
// @TODO Make this case insensitive | |
if (typeof name === "string" && headers[name]) { | |
return headers[name]; | |
} | |
return ""; | |
}; | |
/** | |
* Sends the request to the server. | |
* | |
* @param string data Optional data to send as request body. | |
*/ | |
this.send = function(data) { | |
if (this.readyState != this.OPENED) { | |
throw "INVALID_STATE_ERR: connection must be opened before send() is called"; | |
} | |
if (sendFlag) { | |
throw "INVALID_STATE_ERR: send has already been called"; | |
} | |
var ssl = false, local = false; | |
var url = Url.parse(settings.url); | |
var host; | |
// Determine the server | |
switch (url.protocol) { | |
case 'https:': | |
ssl = true; | |
// SSL & non-SSL both need host, no break here. | |
case 'http:': | |
host = url.hostname; | |
break; | |
case 'file:': | |
local = true; | |
break; | |
case undefined: | |
case '': | |
host = "localhost"; | |
break; | |
default: | |
throw "Protocol not supported."; | |
} | |
// Load files off the local filesystem (file://) | |
if (local) { | |
if (settings.method !== "GET") { | |
throw "XMLHttpRequest: Only GET method is supported"; | |
} | |
if (settings.async) { | |
fs.readFile(url.pathname, 'utf8', function(error, data) { | |
if (error) { | |
self.handleError(error); | |
} else { | |
self.status = 200; | |
self.responseText = data; | |
setState(self.DONE); | |
} | |
}); | |
} else { | |
try { | |
this.responseText = fs.readFileSync(url.pathname, 'utf8'); | |
this.status = 200; | |
setState(self.DONE); | |
} catch(e) { | |
this.handleError(e); | |
} | |
} | |
return; | |
} | |
// Default to port 80. If accessing localhost on another port be sure | |
// to use http://localhost:port/path | |
var port = url.port || (ssl ? 443 : 80); | |
// Add query string if one is used | |
var uri = url.pathname + (url.search ? url.search : ''); | |
// Set the Host header or the server may reject the request | |
headers["Host"] = host; | |
if (!((ssl && port === 443) || port === 80)) { | |
headers["Host"] += ':' + url.port; | |
} | |
// Set Basic Auth if necessary | |
if (settings.user) { | |
if (typeof settings.password == "undefined") { | |
settings.password = ""; | |
} | |
var authBuf = new Buffer(settings.user + ":" + settings.password); | |
headers["Authorization"] = "Basic " + authBuf.toString("base64"); | |
} | |
// Set content length header | |
if (settings.method === "GET" || settings.method === "HEAD") { | |
data = null; | |
} else if (data) { | |
headers["Content-Length"] = Buffer.isBuffer(data) ? data.length : Buffer.byteLength(data); | |
if (!headers["Content-Type"]) { | |
headers["Content-Type"] = "text/plain;charset=UTF-8"; | |
} | |
} else if (settings.method === "POST") { | |
// For a post with no data set Content-Length: 0. | |
// This is required by buggy servers that don't meet the specs. | |
headers["Content-Length"] = 0; | |
} | |
var options = { | |
host: host, | |
port: port, | |
path: uri, | |
method: settings.method, | |
headers: headers, | |
agent: false | |
}; | |
// Reset error flag | |
errorFlag = false; | |
// Handle async requests | |
if (settings.async) { | |
// Use the proper protocol | |
var doRequest = ssl ? https.request : http.request; | |
// Request is being sent, set send flag | |
sendFlag = true; | |
// As per spec, this is called here for historical reasons. | |
self.dispatchEvent("readystatechange"); | |
// Handler for the response | |
function responseHandler(resp) { | |
// Set response var to the response we got back | |
// This is so it remains accessable outside this scope | |
response = resp; | |
// Check for redirect | |
// @TODO Prevent looped redirects | |
if (response.statusCode === 302 || response.statusCode === 303 || response.statusCode === 307) { | |
// Change URL to the redirect location | |
settings.url = response.headers.location; | |
var url = Url.parse(settings.url); | |
// Set host var in case it's used later | |
host = url.hostname; | |
// Options for the new request | |
var newOptions = { | |
hostname: url.hostname, | |
port: url.port, | |
path: url.path, | |
method: response.statusCode === 303 ? 'GET' : settings.method, | |
headers: headers | |
}; | |
// Issue the new request | |
request = doRequest(newOptions, responseHandler).on('error', errorHandler); | |
request.end(); | |
// @TODO Check if an XHR event needs to be fired here | |
return; | |
} | |
response.setEncoding("utf8"); | |
setState(self.HEADERS_RECEIVED); | |
self.status = response.statusCode; | |
response.on('data', function(chunk) { | |
// Make sure there's some data | |
if (chunk) { | |
self.responseText += chunk; | |
} | |
// Don't emit state changes if the connection has been aborted. | |
if (sendFlag) { | |
setState(self.LOADING); | |
} | |
}); | |
response.on('end', function() { | |
if (sendFlag) { | |
// Discard the 'end' event if the connection has been aborted | |
setState(self.DONE); | |
sendFlag = false; | |
} | |
}); | |
response.on('error', function(error) { | |
self.handleError(error); | |
}); | |
} | |
// Error handler for the request | |
function errorHandler(error) { | |
self.handleError(error); | |
} | |
// Create the request | |
request = doRequest(options, responseHandler).on('error', errorHandler); | |
// Node 0.4 and later won't accept empty data. Make sure it's needed. | |
if (data) { | |
request.write(data); | |
} | |
request.end(); | |
self.dispatchEvent("loadstart"); | |
} else { // Synchronous | |
// Create a temporary file for communication with the other Node process | |
var contentFile = ".node-xmlhttprequest-content-" + process.pid; | |
var syncFile = ".node-xmlhttprequest-sync-" + process.pid; | |
fs.writeFileSync(syncFile, "", "utf8"); | |
// The async request the other Node process executes | |
var execString = "var http = require('http'), https = require('https'), fs = require('fs');" | |
+ "var doRequest = http" + (ssl ? "s" : "") + ".request;" | |
+ "var options = " + JSON.stringify(options) + ";" | |
+ "var responseText = '';" | |
+ "var req = doRequest(options, function(response) {" | |
+ "response.setEncoding('utf8');" | |
+ "response.on('data', function(chunk) {" | |
+ " responseText += chunk;" | |
+ "});" | |
+ "response.on('end', function() {" | |
+ "fs.writeFileSync('" + contentFile + "', 'NODE-XMLHTTPREQUEST-STATUS:' + response.statusCode + ',' + responseText, 'utf8');" | |
+ "fs.unlinkSync('" + syncFile + "');" | |
+ "});" | |
+ "response.on('error', function(error) {" | |
+ "fs.writeFileSync('" + contentFile + "', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');" | |
+ "fs.unlinkSync('" + syncFile + "');" | |
+ "});" | |
+ "}).on('error', function(error) {" | |
+ "fs.writeFileSync('" + contentFile + "', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');" | |
+ "fs.unlinkSync('" + syncFile + "');" | |
+ "});" | |
+ (data ? "req.write('" + data.replace(/'/g, "\\'") + "');":"") | |
+ "req.end();"; | |
// Start the other Node Process, executing this string | |
var syncProc = spawn(process.argv[0], ["-e", execString]); | |
var statusText; | |
while(fs.existsSync(syncFile)) { | |
// Wait while the sync file is empty | |
} | |
self.responseText = fs.readFileSync(contentFile, 'utf8'); | |
// Kill the child process once the file has data | |
syncProc.stdin.end(); | |
// Remove the temporary file | |
fs.unlinkSync(contentFile); | |
if (self.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)) { | |
// If the file returned an error, handle it | |
var errorObj = self.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/, ""); | |
self.handleError(errorObj); | |
} else { | |
// If the file returned okay, parse its data and move to the DONE state | |
self.status = self.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:([0-9]*),.*/, "$1"); | |
self.responseText = self.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:[0-9]*,(.*)/, "$1"); | |
setState(self.DONE); | |
} | |
} | |
}; | |
/** | |
* Called when an error is encountered to deal with it. | |
*/ | |
this.handleError = function(error) { | |
this.status = 503; | |
this.statusText = error; | |
this.responseText = error.stack; | |
errorFlag = true; | |
setState(this.DONE); | |
}; | |
/** | |
* Aborts a request. | |
*/ | |
this.abort = function() { | |
if (request) { | |
request.abort(); | |
request = null; | |
} | |
headers = defaultHeaders; | |
this.responseText = ""; | |
this.responseXML = ""; | |
errorFlag = true; | |
if (this.readyState !== this.UNSENT | |
&& (this.readyState !== this.OPENED || sendFlag) | |
&& this.readyState !== this.DONE) { | |
sendFlag = false; | |
setState(this.DONE); | |
} | |
this.readyState = this.UNSENT; | |
}; | |
/** | |
* Adds an event listener. Preferred method of binding to events. | |
*/ | |
this.addEventListener = function(event, callback) { | |
if (!(event in listeners)) { | |
listeners[event] = []; | |
} | |
// Currently allows duplicate callbacks. Should it? | |
listeners[event].push(callback); | |
}; | |
/** | |
* Remove an event callback that has already been bound. | |
* Only works on the matching funciton, cannot be a copy. | |
*/ | |
this.removeEventListener = function(event, callback) { | |
if (event in listeners) { | |
// Filter will return a new array with the callback removed | |
listeners[event] = listeners[event].filter(function(ev) { | |
return ev !== callback; | |
}); | |
} | |
}; | |
/** | |
* Dispatch any events, including both "on" methods and events attached using addEventListener. | |
*/ | |
this.dispatchEvent = function(event) { | |
if (typeof self["on" + event] === "function") { | |
self["on" + event](); | |
} | |
if (event in listeners) { | |
for (var i = 0, len = listeners[event].length; i < len; i++) { | |
listeners[event][i].call(self); | |
} | |
} | |
}; | |
/** | |
* Changes readyState and calls onreadystatechange. | |
* | |
* @param int state New state | |
*/ | |
var setState = function(state) { | |
if (self.readyState !== state) { | |
self.readyState = state; | |
if (settings.async || self.readyState < self.OPENED || self.readyState === self.DONE) { | |
self.dispatchEvent("readystatechange"); | |
} | |
if (self.readyState === self.DONE && !errorFlag) { | |
self.dispatchEvent("load"); | |
// @TODO figure out InspectorInstrumentation::didLoadXHR(cookie) | |
self.dispatchEvent("loadend"); | |
} | |
} | |
}; | |
}; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! (webpack)/~/node-libs-browser/~/buffer/index.js */ 71).Buffer, __webpack_require__(/*! (webpack)/~/node-libs-browser/~/process/browser.js */ 13))) | |
/***/ }, | |
/* 42 */ | |
/*!****************************************************!*\ | |
!*** ./~/jsdom/~/nwmatcher/src/nwmatcher-noqsa.js ***! | |
\****************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(module) {/* | |
* Copyright (C) 2007-2014 Diego Perini | |
* All rights reserved. | |
* | |
* nwmatcher-noqsa.js - A fast CSS selector engine and matcher | |
* | |
* Author: Diego Perini <diego.perini at gmail com> | |
* Version: 1.3.3 | |
* Created: 20070722 | |
* Release: 20140330 | |
* | |
* License: | |
* http://javascript.nwbox.com/NWMatcher/MIT-LICENSE | |
* Download: | |
* http://javascript.nwbox.com/NWMatcher/nwmatcher.js | |
*/ | |
(function(global, factory) { | |
if (true) { | |
module.exports = function (browserGlobal) { | |
// passed global does not contain | |
// references to native objects | |
browserGlobal.console = console; | |
browserGlobal.parseInt = parseInt; | |
browserGlobal.Function = Function; | |
browserGlobal.Boolean = Boolean; | |
browserGlobal.Number = Number; | |
browserGlobal.RegExp = RegExp; | |
browserGlobal.String = String; | |
browserGlobal.Object = Object; | |
browserGlobal.Array = Array; | |
browserGlobal.Error = Error; | |
browserGlobal.Date = Date; | |
browserGlobal.Math = Math; | |
var exports = browserGlobal.Object(); | |
factory(browserGlobal, exports); | |
return exports; | |
}; | |
module.factory = factory; | |
} else { | |
factory(global, | |
(global.NW || (global.NW = global.Object())) && | |
(global.NW.Dom || (global.NW.Dom = global.Object()))); | |
global.NW.Dom.factory = factory; | |
} | |
})(this, function(global, exports) { | |
var version = 'nwmatcher-1.3.3', | |
Dom = exports, | |
doc = global.document, | |
root = doc.documentElement, | |
isSingleMatch, | |
isSingleSelect, | |
lastSlice, | |
lastContext, | |
lastPosition, | |
lastMatcher, | |
lastSelector, | |
lastPartsMatch, | |
lastPartsSelect, | |
operators = '([~*^$|!]?={1})', | |
combinators = '[\\s]|[>+~][^>+~]', | |
pseudoparms = '(?:[-+]?\\d*n)?[-+]?\\d*', | |
quotedvalue = '"[^"]*"' + "|'[^']*'", | |
skipgroup = '\\[.*\\]|\\(.*\\)|\\{.*\\}', | |
encoding = '(?:[-\\w]|[^\\x00-\\xa0]|\\\\.)', | |
identifier = '(?:-?[_a-zA-Z]{1}[-\\w]*|[^\\x00-\\xa0]+|\\\\.+)+', | |
attrcheck = '(' + quotedvalue + '|' + identifier + ')', | |
attributes = '\\s*(' + encoding + '*:?' + encoding + '+)\\s*(?:' + operators + '\\s*' + attrcheck + ')?\\s*', | |
attrmatcher = attributes.replace(attrcheck, '([\\x22\\x27]*)((?:\\\\?.)*?)\\3'), | |
pseudoclass = '((?:' + | |
pseudoparms + '|' + quotedvalue + '|' + | |
'[#.:]?|' + encoding + '+|' + | |
'\\[' + attributes + '\\]|' + | |
'\\(.+\\)|\\s*|' + | |
',)+)', | |
extensions = '.+', | |
standardValidator = | |
'(?=\\s*[^>+~(){}<>])' + | |
'(' + | |
'\\*' + | |
'|(?:[#.:]?' + identifier + ')' + | |
'|' + combinators + | |
'|\\[' + attributes + '\\]' + | |
'|\\(' + pseudoclass + '\\)' + | |
'|\\{' + extensions + '\\}' + | |
'|(?:,|\\s*)' + | |
')+', | |
extendedValidator = standardValidator.replace(pseudoclass, '.*'), | |
reValidator = global.RegExp(standardValidator, 'g'), | |
reTrimSpaces = /^\s*|\s*$/g, | |
reSimpleNot = global.RegExp('^(' + | |
'(?!:not)' + | |
'([#.:]?' + | |
'|' + identifier + | |
'|\\([^()]*\\))+' + | |
'|\\[' + attributes + '\\]' + | |
')$'), | |
reSplitGroup = /([^,\\()[\]]+|\[[^[\]]*\]|\[.*\]|\([^()]+\)|\(.*\)|\{[^{}]+\}|\{.*\}|\\.)+/g, | |
reSplitToken = global.RegExp('(' + | |
'\\[' + attributes + '\\]|' + | |
'\\(' + pseudoclass + '\\)|' + | |
'\\\\.|[^\\s>+~])+', 'g'), | |
reOptimizeSelector = global.RegExp(identifier + '|^$'), | |
QUIRKS_MODE, | |
XML_DOCUMENT, | |
GEBTN = 'getElementsByTagName' in doc, | |
GEBCN = 'getElementsByClassName' in doc, | |
LINK_NODES = global.Object({ a: 1, A: 1, area: 1, AREA: 1, link: 1, LINK: 1 }), | |
ATTR_BOOLEAN = global.Object({ | |
checked: 1, disabled: 1, ismap: 1, | |
multiple: 1, readonly: 1, selected: 1 | |
}), | |
ATTR_DEFAULT = global.Object({ | |
value: 'defaultValue', | |
checked: 'defaultChecked', | |
selected: 'defaultSelected' | |
}), | |
ATTR_URIDATA = global.Object({ | |
action: 2, cite: 2, codebase: 2, data: 2, href: 2, | |
longdesc: 2, lowsrc: 2, src: 2, usemap: 2 | |
}), | |
Selectors = global.Object({ | |
}), | |
Operators = global.Object({ | |
'=': "n=='%m'", | |
'^=': "n.indexOf('%m')==0", | |
'*=': "n.indexOf('%m')>-1", | |
'|=': "(n+'-').indexOf('%m-')==0", | |
'~=': "(' '+n+' ').indexOf(' %m ')>-1", | |
'$=': "n.substr(n.length-'%m'.length)=='%m'" | |
}), | |
Optimize = global.Object({ | |
ID: global.RegExp('^\\*?#(' + encoding + '+)|' + skipgroup), | |
TAG: global.RegExp('^(' + encoding + '+)|' + skipgroup), | |
CLASS: global.RegExp('^\\*?\\.(' + encoding + '+$)|' + skipgroup) | |
}), | |
Patterns = global.Object({ | |
spseudos: /^\:(root|empty|(?:first|last|only)(?:-child|-of-type)|nth(?:-last)?(?:-child|-of-type)\(\s*(even|odd|(?:[-+]{0,1}\d*n\s*)?[-+]{0,1}\s*\d*)\s*\))?(.*)/i, | |
dpseudos: /^\:(link|visited|target|active|focus|hover|checked|disabled|enabled|selected|lang\(([-\w]{2,})\)|not\(([^()]*|.*)\))?(.*)/i, | |
attribute: global.RegExp('^\\[' + attrmatcher + '\\](.*)'), | |
children: /^\s*\>\s*(.*)/, | |
adjacent: /^\s*\+\s*(.*)/, | |
relative: /^\s*\~\s*(.*)/, | |
ancestor: /^\s+(.*)/, | |
universal: /^\*(.*)/, | |
id: global.RegExp('^#(' + encoding + '+)(.*)'), | |
tagName: global.RegExp('^(' + encoding + '+)(.*)'), | |
className: global.RegExp('^\\.(' + encoding + '+)(.*)') | |
}), | |
concatCall = | |
function(data, elements, callback) { | |
var i = -1, element; | |
while ((element = elements[++i])) { | |
if (false === callback(data[data.length] = element)) { break; } | |
} | |
return data; | |
}, | |
switchContext = | |
function(from, force) { | |
var oldDoc = doc; | |
lastContext = from; | |
doc = from.ownerDocument || from; | |
if (force || oldDoc !== doc) { | |
root = doc.documentElement; | |
XML_DOCUMENT = doc.createElement('DiV').nodeName == 'DiV'; | |
QUIRKS_MODE = !XML_DOCUMENT && | |
typeof doc.compatMode == 'string' ? | |
doc.compatMode.indexOf('CSS') < 0 : | |
(function() { | |
var style = doc.createElement('div').style; | |
return style && (style.width = 1) && style.width == '1px'; | |
})(); | |
Config.CACHING && Dom.setCache(true, doc); | |
} | |
}, | |
byIdRaw = | |
function(id, elements) { | |
var i = -1, element = null; | |
while ((element = elements[++i])) { | |
if (element.getAttribute('id') == id) { | |
break; | |
} | |
} | |
return element; | |
}, | |
_byId = !('fileSize' in doc) ? | |
function(id, from) { | |
id = id.replace(/\\([^\\]{1})/g, '$1'); | |
return from.getElementById && from.getElementById(id) || | |
byIdRaw(id, from.getElementsByTagName('*')); | |
} : | |
function(id, from) { | |
var element = null; | |
id = id.replace(/\\([^\\]{1})/g, '$1'); | |
if (XML_DOCUMENT || from.nodeType != 9) { | |
return byIdRaw(id, from.getElementsByTagName('*')); | |
} | |
if ((element = from.getElementById(id)) && | |
element.name == id && from.getElementsByName) { | |
return byIdRaw(id, from.getElementsByName(id)); | |
} | |
return element; | |
}, | |
byId = | |
function(id, from) { | |
from || (from = doc); | |
if (lastContext !== from) { switchContext(from); } | |
return _byId(id, from); | |
}, | |
byTagRaw = | |
function(tag, from) { | |
var any = tag == '*', element = from, elements = global.Array(), next = element.firstChild; | |
any || (tag = tag.toUpperCase()); | |
while ((element = next)) { | |
if (element.tagName > '@' && (any || element.tagName.toUpperCase() == tag)) { | |
elements[elements.length] = element; | |
} | |
if ((next = element.firstChild || element.nextSibling)) continue; | |
while (!next && (element = element.parentNode) && element !== from) { | |
next = element.nextSibling; | |
} | |
} | |
return elements; | |
}, | |
contains = 'compareDocumentPosition' in root ? | |
function(container, element) { | |
return (container.compareDocumentPosition(element) & 16) == 16; | |
} : 'contains' in root ? | |
function(container, element) { | |
return element.nodeType == 1 && container.contains(element); | |
} : | |
function(container, element) { | |
while ((element = element.parentNode) && element.nodeType == 1) { | |
if (element === container) return true; | |
} | |
return false; | |
}, | |
getAttribute = | |
function(node, attribute) { | |
attribute = attribute.toLowerCase(); | |
if (typeof node[attribute] == 'object') { | |
return node.attributes[attribute] && | |
node.attributes[attribute].value || ''; | |
} | |
return ( | |
attribute == 'type' ? node.getAttribute(attribute) || '' : | |
ATTR_URIDATA[attribute] ? node.getAttribute(attribute, 2) || '' : | |
ATTR_BOOLEAN[attribute] ? node.getAttribute(attribute) ? attribute : 'false' : | |
((node = node.getAttributeNode(attribute)) && node.value) || ''); | |
}, | |
hasAttribute = root.hasAttribute ? | |
function(node, attribute) { | |
return node.hasAttribute(attribute); | |
} : | |
function(node, attribute) { | |
attribute = attribute.toLowerCase(); | |
if (ATTR_DEFAULT[attribute]) { | |
return !!node[ATTR_DEFAULT[attribute]]; | |
} | |
node = node.getAttributeNode(attribute); | |
return !!(node && node.specified); | |
}, | |
isLink = | |
function(element) { | |
return element.getAttribute('href') && LINK_NODES[element.nodeName]; | |
}, | |
isEmpty = | |
function(node) { | |
node = node.firstChild; | |
while (node) { | |
if (node.nodeType == 3 || node.nodeName > '@') return false; | |
node = node.nextSibling; | |
} | |
return true; | |
}, | |
nthElement = | |
function(element, last) { | |
var count = 1, succ = last ? 'nextSibling' : 'previousSibling'; | |
while ((element = element[succ])) { | |
if (element.nodeName > '@') ++count; | |
} | |
return count; | |
}, | |
nthOfType = | |
function(element, last) { | |
var count = 1, succ = last ? 'nextSibling' : 'previousSibling', type = element.nodeName; | |
while ((element = element[succ])) { | |
if (element.nodeName == type) ++count; | |
} | |
return count; | |
}, | |
configure = | |
function(option) { | |
if (typeof option == 'string') { return Config[option]; } | |
if (typeof option != 'object') { return false; } | |
for (var i in option) { | |
Config[i] = !!option[i]; | |
if (i == 'SIMPLENOT') { | |
matchContexts = global.Object(); | |
matchResolvers = global.Object(); | |
selectContexts = global.Object(); | |
selectResolvers = global.Object(); | |
} | |
} | |
reValidator = global.RegExp(Config.SIMPLENOT ? | |
standardValidator : extendedValidator, 'g'); | |
return true; | |
}, | |
emit = | |
function(message) { | |
if (Config.VERBOSITY) { throw global.Error(message); } | |
if (global.console && global.console.log) { | |
global.console.log(message); | |
} | |
}, | |
Config = global.Object({ | |
CACHING: false, | |
SIMPLENOT: true, | |
UNIQUE_ID: true, | |
USE_HTML5: true, | |
VERBOSITY: true | |
}), | |
IE_LT_9 = typeof doc.addEventListener != 'function', | |
INSENSITIVE_MAP = global.Object({ | |
href: 1, lang: 1, src: 1, style: 1, title: 1, | |
type: 1, xmlns: 1, 'xml:lang': 1, 'xml:space': 1 | |
}), | |
TO_UPPER_CASE = IE_LT_9 ? '.toUpperCase()' : '', | |
ACCEPT_NODE = 'r[r.length]=c[k];if(f&&false===f(c[k]))break main;else continue main;', | |
REJECT_NODE = IE_LT_9 ? 'if(e.nodeName<"A")continue;' : '', | |
compile = | |
function(selector, source, mode) { | |
var parts = typeof selector == 'string' ? selector.match(reSplitGroup) : selector; | |
typeof source == 'string' || (source = ''); | |
if (parts.length == 1) { | |
source += compileSelector(parts[0], mode ? ACCEPT_NODE : 'f&&f(k);return true;', mode); | |
} else { | |
var i = -1, seen = global.Object(), token; | |
while ((token = parts[++i])) { | |
token = token.replace(reTrimSpaces, ''); | |
if (!seen[token] && (seen[token] = true)) { | |
source += compileSelector(token, mode ? ACCEPT_NODE : 'f&&f(k);return true;', mode); | |
} | |
} | |
} | |
if (mode) { | |
return global.Function('c,s,r,d,h,g,f,v', | |
'var N,n,x=0,k=-1,e;main:while((e=c[++k])){' + source + '}return r;'); | |
} else { | |
return global.Function('e,s,r,d,h,g,f,v', | |
'var N,n,x=0,k=e;' + source + 'return false;'); | |
} | |
}, | |
FILTER = | |
'var z=v[@]||(v[@]=[]),l=z.length-1;' + | |
'while(l>=0&&z[l]!==e)--l;' + | |
'if(l!==-1){break;}' + | |
'z[z.length]=e;', | |
compileSelector = | |
function(selector, source, mode) { | |
var a, b, n, k = 0, expr, match, name, result, status, test, type; | |
while (selector) { | |
k++; | |
if ((match = selector.match(Patterns.universal))) { | |
expr = ''; | |
} | |
else if ((match = selector.match(Patterns.id))) { | |
source = 'if(' + (XML_DOCUMENT ? | |
's.getAttribute(e,"id")' : | |
'(e.submit?s.getAttribute(e,"id"):e.id)') + | |
'=="' + match[1] + '"' + | |
'){' + source + '}'; | |
} | |
else if ((match = selector.match(Patterns.tagName))) { | |
source = 'if(e.nodeName' + (XML_DOCUMENT ? | |
'=="' + match[1] + '"' : TO_UPPER_CASE + | |
'=="' + match[1].toUpperCase() + '"') + | |
'){' + source + '}'; | |
} | |
else if ((match = selector.match(Patterns.className))) { | |
source = 'if((n=' + (XML_DOCUMENT ? | |
'e.getAttribute("class")' : 'e.className') + | |
')&&n.length&&(" "+' + (QUIRKS_MODE ? 'n.toLowerCase()' : 'n') + | |
'.replace(/\\s+/g," ")+" ").indexOf(" ' + | |
(QUIRKS_MODE ? match[1].toLowerCase() : match[1]) + ' ")>-1' + | |
'){' + source + '}'; | |
} | |
else if ((match = selector.match(Patterns.attribute))) { | |
if (match[2] && !Operators[match[2]]) { | |
emit('Unsupported operator in attribute selectors "' + selector + '"'); | |
return ''; | |
} | |
test = 'false'; | |
if (match[4]) { | |
type = INSENSITIVE_MAP[match[1].toLowerCase()]; | |
match[4] = | |
(type ? match[4].toLowerCase() : match[4]). | |
replace(/\\([0-9a-f]{2,2})/g, '\\x$1'). | |
replace(/(\x22|\x27)/g, '\\$1'); | |
} | |
if (match[2] && match[4] && (test = Operators[match[2]])) { | |
test = test.replace(/\%m/g, match[4]); | |
} else if (match[2] == '!=' || match[2] == '=') { | |
test = 'n' + match[2] + '="' + match[4] + '"'; | |
} | |
expr = 'n=s.' + (match[2] ? 'get' : 'has') + 'Attribute(e,"' + match[1] + '")' + (type ? '.toLowerCase();' : ';'); | |
source = expr + 'if(' + (match[2] ? test : 'n') + '){' + source + '}'; | |
} | |
else if ((match = selector.match(Patterns.adjacent))) { | |
source = (mode ? '' : FILTER.replace(/@/g, k)) + source; | |
source = 'var N' + k + '=e;while(e&&(e=e.previousSibling)){if(e.nodeName>"@"){' + source + 'break;}}e=N' + k + ';'; | |
} | |
else if ((match = selector.match(Patterns.relative))) { | |
source = (mode ? '' : FILTER.replace(/@/g, k)) + source; | |
source = 'var N' + k + '=e;e=e.parentNode.firstChild;while(e&&e!==N' + k + '){if(e.nodeName>"@"){' + source + '}e=e.nextSibling;}e=N' + k + ';'; | |
} | |
else if ((match = selector.match(Patterns.children))) { | |
source = (mode ? '' : FILTER.replace(/@/g, k)) + source; | |
source = 'var N' + k + '=e;while(e&&e!==h&&e!==g&&(e=e.parentNode)){' + source + 'break;}e=N' + k + ';'; | |
} | |
else if ((match = selector.match(Patterns.ancestor))) { | |
source = (mode ? '' : FILTER.replace(/@/g, k)) + source; | |
source = 'var N' + k + '=e;while(e&&e!==h&&e!==g&&(e=e.parentNode)){' + source + '}e=N' + k + ';'; | |
} | |
else if ((match = selector.match(Patterns.spseudos)) && match[1]) { | |
switch (match[1]) { | |
case 'root': | |
if (match[3]) { | |
source = 'if(e===h||s.contains(h,e)){' + source + '}'; | |
} else { | |
source = 'if(e===h){' + source + '}'; | |
} | |
break; | |
case 'empty': | |
source = 'if(s.isEmpty(e)){' + source + '}'; | |
break; | |
default: | |
if (match[1] && match[2]) { | |
if (match[2] == 'n') { | |
source = 'if(e!==h){' + source + '}'; | |
break; | |
} else if (match[2] == 'even') { | |
a = 2; | |
b = 0; | |
} else if (match[2] == 'odd') { | |
a = 2; | |
b = 1; | |
} else { | |
b = ((n = match[2].match(/(-?\d+)$/)) ? global.parseInt(n[1], 10) : 0); | |
a = ((n = match[2].match(/(-?\d*)n/i)) ? global.parseInt(n[1], 10) : 0); | |
if (n && n[1] == '-') a = -1; | |
} | |
test = a > 1 ? | |
(/last/i.test(match[1])) ? '(n-(' + b + '))%' + a + '==0' : | |
'n>=' + b + '&&(n-(' + b + '))%' + a + '==0' : a < -1 ? | |
(/last/i.test(match[1])) ? '(n-(' + b + '))%' + a + '==0' : | |
'n<=' + b + '&&(n-(' + b + '))%' + a + '==0' : a=== 0 ? | |
'n==' + b : | |
(/last/i.test(match[1])) ? | |
a == -1 ? 'n>=' + b : 'n<=' + b : | |
a == -1 ? 'n<=' + b : 'n>=' + b; | |
source = | |
'if(e!==h){' + | |
'n=s[' + (/-of-type/i.test(match[1]) ? '"nthOfType"' : '"nthElement"') + ']' + | |
'(e,' + (/last/i.test(match[1]) ? 'true' : 'false') + ');' + | |
'if(' + test + '){' + source + '}' + | |
'}'; | |
} else { | |
a = /first/i.test(match[1]) ? 'previous' : 'next'; | |
n = /only/i.test(match[1]) ? 'previous' : 'next'; | |
b = /first|last/i.test(match[1]); | |
type = /-of-type/i.test(match[1]) ? '&&n.nodeName!=e.nodeName' : '&&n.nodeName<"@"'; | |
source = 'if(e!==h){' + | |
( 'n=e;while((n=n.' + a + 'Sibling)' + type + ');if(!n){' + (b ? source : | |
'n=e;while((n=n.' + n + 'Sibling)' + type + ');if(!n){' + source + '}') + '}' ) + '}'; | |
} | |
break; | |
} | |
} | |
else if ((match = selector.match(Patterns.dpseudos)) && match[1]) { | |
switch (match[1].match(/^\w+/)[0]) { | |
case 'not': | |
expr = match[3].replace(reTrimSpaces, ''); | |
if (Config.SIMPLENOT && !reSimpleNot.test(expr)) { | |
emit('Negation pseudo-class only accepts simple selectors "' + match.join('') + '"'); | |
return ''; | |
} else { | |
if ('compatMode' in doc) { | |
source = 'if(!' + compile(expr, '', false) + '(e,s,r,d,h,g)){' + source + '}'; | |
} else { | |
source = 'if(!s.match(e, "' + expr.replace(/\x22/g, '\\"') + '",g)){' + source +'}'; | |
} | |
} | |
break; | |
case 'checked': | |
source = 'if((typeof e.form!=="undefined"&&(/^(?:radio|checkbox)$/i).test(e.type)&&e.checked)' + | |
(Config.USE_HTML5 ? '||(/^option$/i.test(e.nodeName)&&(e.selected||e.checked))' : '') + | |
'){' + source + '}'; | |
break; | |
case 'disabled': | |
source = 'if(((typeof e.form!=="undefined"' + | |
(Config.USE_HTML5 ? '' : '&&!(/^hidden$/i).test(e.type)') + | |
')||s.isLink(e))&&e.disabled===true){' + source + '}'; | |
break; | |
case 'enabled': | |
source = 'if(((typeof e.form!=="undefined"' + | |
(Config.USE_HTML5 ? '' : '&&!(/^hidden$/i).test(e.type)') + | |
')||s.isLink(e))&&e.disabled===false){' + source + '}'; | |
break; | |
case 'lang': | |
test = ''; | |
if (match[2]) test = match[2].substr(0, 2) + '-'; | |
source = 'do{(n=e.lang||"").toLowerCase();' + | |
'if((n==""&&h.lang=="' + match[2].toLowerCase() + '")||' + | |
'(n&&(n=="' + match[2].toLowerCase() + | |
'"||n.substr(0,3)=="' + test.toLowerCase() + '")))' + | |
'{' + source + 'break;}}while((e=e.parentNode)&&e!==g);'; | |
break; | |
case 'target': | |
n = doc.location ? doc.location.hash : ''; | |
if (n) { | |
source = 'if(e.id=="' + n.slice(1) + '"){' + source + '}'; | |
} | |
break; | |
case 'link': | |
source = 'if(s.isLink(e)&&!e.visited){' + source + '}'; | |
break; | |
case 'visited': | |
source = 'if(s.isLink(e)&&e.visited){' + source + '}'; | |
break; | |
case 'active': | |
source = 'if(e===d.activeElement){' + source + '}'; | |
break; | |
case 'hover': | |
source = 'if(e===d.hoverElement){' + source + '}'; | |
break; | |
case 'focus': | |
source = 'hasFocus' in doc ? | |
'if(e===d.activeElement&&d.hasFocus()&&(e.type||e.href||typeof e.tabIndex=="number")){' + source + '}' : | |
'if(e===d.activeElement&&(e.type||e.href)){' + source + '}'; | |
break; | |
case 'selected': | |
source = 'if(/^option$/i.test(e.nodeName)&&(e.selected||e.checked)){' + source + '}'; | |
break; | |
default: | |
break; | |
} | |
} | |
else { | |
expr = false; | |
status = false; | |
for (expr in Selectors) { | |
if ((match = selector.match(Selectors[expr].Expression)) && match[1]) { | |
result = Selectors[expr].Callback(match, source); | |
source = result.source; | |
status = result.status; | |
if (status) { break; } | |
} | |
} | |
if (!status) { | |
emit('Unknown pseudo-class selector "' + selector + '"'); | |
return ''; | |
} | |
if (!expr) { | |
emit('Unknown token in selector "' + selector + '"'); | |
return ''; | |
} | |
} | |
if (!match) { | |
emit('Invalid syntax in selector "' + selector + '"'); | |
return ''; | |
} | |
selector = match && match[match.length - 1]; | |
} | |
return source; | |
}, | |
match = | |
function(element, selector, from, callback) { | |
var parts; | |
if (!(element && element.nodeName > '@')) { | |
emit('Invalid element argument'); | |
return false; | |
} else if (typeof selector != 'string') { | |
emit('Invalid selector argument'); | |
return false; | |
} else if (lastContext !== from) { | |
switchContext(from || (from = element.ownerDocument)); | |
} | |
selector = selector.replace(reTrimSpaces, ''); | |
Config.SHORTCUTS && (selector = Dom.shortcuts(selector, element, from)); | |
if (lastMatcher != selector) { | |
if ((parts = selector.match(reValidator)) && parts[0] == selector) { | |
isSingleMatch = (parts = selector.match(reSplitGroup)).length < 2; | |
lastMatcher = selector; | |
lastPartsMatch = parts; | |
} else { | |
emit('The string "' + selector + '", is not a valid CSS selector'); | |
return false; | |
} | |
} else parts = lastPartsMatch; | |
if (!matchResolvers[selector] || matchContexts[selector] !== from) { | |
matchResolvers[selector] = compile(isSingleMatch ? [selector] : parts, '', false); | |
matchContexts[selector] = from; | |
} | |
return matchResolvers[selector](element, Snapshot, [ ], doc, root, from, callback, { }); | |
}, | |
first = | |
function(selector, from) { | |
return select(selector, from, function() { return false; })[0] || null; | |
}, | |
select = | |
function(selector, from, callback) { | |
var i, changed, element, elements, parts, token, original = selector; | |
if (arguments.length === 0) { | |
emit('Not enough arguments'); | |
return [ ]; | |
} else if (typeof selector != 'string') { | |
return [ ]; | |
} else if (from && !(/1|9|11/).test(from.nodeType)) { | |
emit('Invalid or illegal context element'); | |
return [ ]; | |
} else if (lastContext !== from) { | |
switchContext(from || (from = doc)); | |
} | |
if (Config.CACHING && (elements = Dom.loadResults(original, from, doc, root))) { | |
return callback ? concatCall([ ], elements, callback) : elements; | |
} | |
selector = selector.replace(reTrimSpaces, ''); | |
Config.SHORTCUTS && (selector = Dom.shortcuts(selector, from)); | |
if ((changed = lastSelector != selector)) { | |
if ((parts = selector.match(reValidator)) && parts[0] == selector) { | |
isSingleSelect = (parts = selector.match(reSplitGroup)).length < 2; | |
lastSelector = selector; | |
lastPartsSelect = parts; | |
} else { | |
emit('The string "' + selector + '", is not a valid CSS selector'); | |
return [ ]; | |
} | |
} else parts = lastPartsSelect; | |
if (from.nodeType == 11) { | |
elements = byTagRaw('*', from); | |
} else if (isSingleSelect) { | |
if (changed) { | |
parts = selector.match(reSplitToken); | |
token = parts[parts.length - 1]; | |
lastSlice = token.split(':not')[0]; | |
lastPosition = selector.length - token.length; | |
} | |
if (Config.UNIQUE_ID && (parts = lastSlice.match(Optimize.ID)) && (token = parts[1])) { | |
if ((element = _byId(token, from))) { | |
if (match(element, selector)) { | |
callback && callback(element); | |
elements = global.Array(element); | |
} else elements = global.Array(); | |
} | |
} | |
else if (Config.UNIQUE_ID && (parts = selector.match(Optimize.ID)) && (token = parts[1])) { | |
if ((element = _byId(token, doc))) { | |
if ('#' + token == selector) { | |
callback && callback(element); | |
elements = global.Array(element); | |
} else if (/[>+~]/.test(selector)) { | |
from = element.parentNode; | |
} else { | |
from = element; | |
} | |
} else elements = global.Array(); | |
} | |
if (elements) { | |
Config.CACHING && Dom.saveResults(original, from, doc, elements); | |
return elements; | |
} | |
if (!XML_DOCUMENT && GEBTN && (parts = lastSlice.match(Optimize.TAG)) && (token = parts[1])) { | |
if ((elements = from.getElementsByTagName(token)).length === 0) { return [ ]; } | |
selector = selector.slice(0, lastPosition) + selector.slice(lastPosition).replace(token, '*'); | |
} | |
else if (!XML_DOCUMENT && GEBCN && (parts = lastSlice.match(Optimize.CLASS)) && (token = parts[1])) { | |
if ((elements = from.getElementsByClassName(token.replace(/\\([^\\]{1})/g, '$1'))).length === 0) { return [ ]; } | |
selector = selector.slice(0, lastPosition) + selector.slice(lastPosition).replace('.' + token, | |
reOptimizeSelector.test(selector.charAt(selector.indexOf(token) - 1)) ? '' : '*'); | |
} | |
} | |
if (!elements) { | |
if (IE_LT_9) { | |
elements = /^(?:applet|object)$/i.test(from.nodeName) ? from.childNodes : from.all; | |
} else { | |
elements = from.getElementsByTagName('*'); | |
} | |
} | |
if (!selectResolvers[selector] || selectContexts[selector] !== from) { | |
selectResolvers[selector] = compile(isSingleSelect ? [selector] : parts, REJECT_NODE, true); | |
selectContexts[selector] = from; | |
} | |
elements = selectResolvers[selector](elements, Snapshot, [ ], doc, root, from, callback, { }); | |
Config.CACHING && Dom.saveResults(original, from, doc, elements); | |
return elements; | |
}, | |
FN = function(x) { return x; }, | |
matchContexts = global.Object(), | |
matchResolvers = global.Object(), | |
selectContexts = global.Object(), | |
selectResolvers = global.Object(), | |
Snapshot = global.Object({ | |
byId: _byId, | |
match: match, | |
select: select, | |
isLink: isLink, | |
isEmpty: isEmpty, | |
contains: contains, | |
nthOfType: nthOfType, | |
nthElement: nthElement, | |
getAttribute: getAttribute, | |
hasAttribute: hasAttribute | |
}); | |
Dom.ACCEPT_NODE = ACCEPT_NODE; | |
Dom.byId = byId; | |
Dom.match = match; | |
Dom.first = first; | |
Dom.select = select; | |
Dom.compile = compile; | |
Dom.contains = contains; | |
Dom.configure = configure; | |
Dom.getAttribute = getAttribute; | |
Dom.hasAttribute = hasAttribute; | |
Dom.setCache = FN; | |
Dom.shortcuts = FN; | |
Dom.loadResults = FN; | |
Dom.saveResults = FN; | |
Dom.emit = emit; | |
Dom.Config = Config; | |
Dom.Snapshot = Snapshot; | |
Dom.Operators = Operators; | |
Dom.Selectors = Selectors; | |
Dom.Version = version; | |
Dom.registerOperator = | |
function(symbol, resolver) { | |
Operators[symbol] || (Operators[symbol] = resolver); | |
}; | |
Dom.registerSelector = | |
function(name, rexp, func) { | |
Selectors[name] || (Selectors[name] = global.Object({ | |
Expression: rexp, | |
Callback: func | |
})); | |
}; | |
switchContext(doc, true); | |
}); | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! (webpack)/buildin/module.js */ 27)(module))) | |
/***/ }, | |
/* 43 */ | |
/*!****************************************************************!*\ | |
!*** (webpack)/~/node-libs-browser/~/querystring-es3/index.js ***! | |
\****************************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
'use strict'; | |
exports.decode = exports.parse = __webpack_require__(/*! ./decode */ 68); | |
exports.encode = exports.stringify = __webpack_require__(/*! ./encode */ 69); | |
/***/ }, | |
/* 44 */ | |
/*!******************************************************************!*\ | |
!*** (webpack)/~/node-libs-browser/~/url/~/punycode/punycode.js ***! | |
\******************************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {/*! http://mths.be/punycode v1.2.4 by @mathias */ | |
;(function(root) { | |
/** Detect free variables */ | |
var freeExports = typeof exports == 'object' && exports; | |
var freeModule = typeof module == 'object' && module && | |
module.exports == freeExports && module; | |
var freeGlobal = typeof global == 'object' && global; | |
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { | |
root = freeGlobal; | |
} | |
/** | |
* The `punycode` object. | |
* @name punycode | |
* @type Object | |
*/ | |
var punycode, | |
/** Highest positive signed 32-bit float value */ | |
maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 | |
/** Bootstring parameters */ | |
base = 36, | |
tMin = 1, | |
tMax = 26, | |
skew = 38, | |
damp = 700, | |
initialBias = 72, | |
initialN = 128, // 0x80 | |
delimiter = '-', // '\x2D' | |
/** Regular expressions */ | |
regexPunycode = /^xn--/, | |
regexNonASCII = /[^ -~]/, // unprintable ASCII chars + non-ASCII chars | |
regexSeparators = /\x2E|\u3002|\uFF0E|\uFF61/g, // RFC 3490 separators | |
/** Error messages */ | |
errors = { | |
'overflow': 'Overflow: input needs wider integers to process', | |
'not-basic': 'Illegal input >= 0x80 (not a basic code point)', | |
'invalid-input': 'Invalid input' | |
}, | |
/** Convenience shortcuts */ | |
baseMinusTMin = base - tMin, | |
floor = Math.floor, | |
stringFromCharCode = String.fromCharCode, | |
/** Temporary variable */ | |
key; | |
/*--------------------------------------------------------------------------*/ | |
/** | |
* A generic error utility function. | |
* @private | |
* @param {String} type The error type. | |
* @returns {Error} Throws a `RangeError` with the applicable error message. | |
*/ | |
function error(type) { | |
throw RangeError(errors[type]); | |
} | |
/** | |
* A generic `Array#map` utility function. | |
* @private | |
* @param {Array} array The array to iterate over. | |
* @param {Function} callback The function that gets called for every array | |
* item. | |
* @returns {Array} A new array of values returned by the callback function. | |
*/ | |
function map(array, fn) { | |
var length = array.length; | |
while (length--) { | |
array[length] = fn(array[length]); | |
} | |
return array; | |
} | |
/** | |
* A simple `Array#map`-like wrapper to work with domain name strings. | |
* @private | |
* @param {String} domain The domain name. | |
* @param {Function} callback The function that gets called for every | |
* character. | |
* @returns {Array} A new string of characters returned by the callback | |
* function. | |
*/ | |
function mapDomain(string, fn) { | |
return map(string.split(regexSeparators), fn).join('.'); | |
} | |
/** | |
* Creates an array containing the numeric code points of each Unicode | |
* character in the string. While JavaScript uses UCS-2 internally, | |
* this function will convert a pair of surrogate halves (each of which | |
* UCS-2 exposes as separate characters) into a single code point, | |
* matching UTF-16. | |
* @see `punycode.ucs2.encode` | |
* @see <http://mathiasbynens.be/notes/javascript-encoding> | |
* @memberOf punycode.ucs2 | |
* @name decode | |
* @param {String} string The Unicode input string (UCS-2). | |
* @returns {Array} The new array of code points. | |
*/ | |
function ucs2decode(string) { | |
var output = [], | |
counter = 0, | |
length = string.length, | |
value, | |
extra; | |
while (counter < length) { | |
value = string.charCodeAt(counter++); | |
if (value >= 0xD800 && value <= 0xDBFF && counter < length) { | |
// high surrogate, and there is a next character | |
extra = string.charCodeAt(counter++); | |
if ((extra & 0xFC00) == 0xDC00) { // low surrogate | |
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); | |
} else { | |
// unmatched surrogate; only append this code unit, in case the next | |
// code unit is the high surrogate of a surrogate pair | |
output.push(value); | |
counter--; | |
} | |
} else { | |
output.push(value); | |
} | |
} | |
return output; | |
} | |
/** | |
* Creates a string based on an array of numeric code points. | |
* @see `punycode.ucs2.decode` | |
* @memberOf punycode.ucs2 | |
* @name encode | |
* @param {Array} codePoints The array of numeric code points. | |
* @returns {String} The new Unicode string (UCS-2). | |
*/ | |
function ucs2encode(array) { | |
return map(array, function(value) { | |
var output = ''; | |
if (value > 0xFFFF) { | |
value -= 0x10000; | |
output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); | |
value = 0xDC00 | value & 0x3FF; | |
} | |
output += stringFromCharCode(value); | |
return output; | |
}).join(''); | |
} | |
/** | |
* Converts a basic code point into a digit/integer. | |
* @see `digitToBasic()` | |
* @private | |
* @param {Number} codePoint The basic numeric code point value. | |
* @returns {Number} The numeric value of a basic code point (for use in | |
* representing integers) in the range `0` to `base - 1`, or `base` if | |
* the code point does not represent a value. | |
*/ | |
function basicToDigit(codePoint) { | |
if (codePoint - 48 < 10) { | |
return codePoint - 22; | |
} | |
if (codePoint - 65 < 26) { | |
return codePoint - 65; | |
} | |
if (codePoint - 97 < 26) { | |
return codePoint - 97; | |
} | |
return base; | |
} | |
/** | |
* Converts a digit/integer into a basic code point. | |
* @see `basicToDigit()` | |
* @private | |
* @param {Number} digit The numeric value of a basic code point. | |
* @returns {Number} The basic code point whose value (when used for | |
* representing integers) is `digit`, which needs to be in the range | |
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is | |
* used; else, the lowercase form is used. The behavior is undefined | |
* if `flag` is non-zero and `digit` has no uppercase form. | |
*/ | |
function digitToBasic(digit, flag) { | |
// 0..25 map to ASCII a..z or A..Z | |
// 26..35 map to ASCII 0..9 | |
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); | |
} | |
/** | |
* Bias adaptation function as per section 3.4 of RFC 3492. | |
* http://tools.ietf.org/html/rfc3492#section-3.4 | |
* @private | |
*/ | |
function adapt(delta, numPoints, firstTime) { | |
var k = 0; | |
delta = firstTime ? floor(delta / damp) : delta >> 1; | |
delta += floor(delta / numPoints); | |
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { | |
delta = floor(delta / baseMinusTMin); | |
} | |
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); | |
} | |
/** | |
* Converts a Punycode string of ASCII-only symbols to a string of Unicode | |
* symbols. | |
* @memberOf punycode | |
* @param {String} input The Punycode string of ASCII-only symbols. | |
* @returns {String} The resulting string of Unicode symbols. | |
*/ | |
function decode(input) { | |
// Don't use UCS-2 | |
var output = [], | |
inputLength = input.length, | |
out, | |
i = 0, | |
n = initialN, | |
bias = initialBias, | |
basic, | |
j, | |
index, | |
oldi, | |
w, | |
k, | |
digit, | |
t, | |
/** Cached calculation results */ | |
baseMinusT; | |
// Handle the basic code points: let `basic` be the number of input code | |
// points before the last delimiter, or `0` if there is none, then copy | |
// the first basic code points to the output. | |
basic = input.lastIndexOf(delimiter); | |
if (basic < 0) { | |
basic = 0; | |
} | |
for (j = 0; j < basic; ++j) { | |
// if it's not a basic code point | |
if (input.charCodeAt(j) >= 0x80) { | |
error('not-basic'); | |
} | |
output.push(input.charCodeAt(j)); | |
} | |
// Main decoding loop: start just after the last delimiter if any basic code | |
// points were copied; start at the beginning otherwise. | |
for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { | |
// `index` is the index of the next character to be consumed. | |
// Decode a generalized variable-length integer into `delta`, | |
// which gets added to `i`. The overflow checking is easier | |
// if we increase `i` as we go, then subtract off its starting | |
// value at the end to obtain `delta`. | |
for (oldi = i, w = 1, k = base; /* no condition */; k += base) { | |
if (index >= inputLength) { | |
error('invalid-input'); | |
} | |
digit = basicToDigit(input.charCodeAt(index++)); | |
if (digit >= base || digit > floor((maxInt - i) / w)) { | |
error('overflow'); | |
} | |
i += digit * w; | |
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); | |
if (digit < t) { | |
break; | |
} | |
baseMinusT = base - t; | |
if (w > floor(maxInt / baseMinusT)) { | |
error('overflow'); | |
} | |
w *= baseMinusT; | |
} | |
out = output.length + 1; | |
bias = adapt(i - oldi, out, oldi == 0); | |
// `i` was supposed to wrap around from `out` to `0`, | |
// incrementing `n` each time, so we'll fix that now: | |
if (floor(i / out) > maxInt - n) { | |
error('overflow'); | |
} | |
n += floor(i / out); | |
i %= out; | |
// Insert `n` at position `i` of the output | |
output.splice(i++, 0, n); | |
} | |
return ucs2encode(output); | |
} | |
/** | |
* Converts a string of Unicode symbols to a Punycode string of ASCII-only | |
* symbols. | |
* @memberOf punycode | |
* @param {String} input The string of Unicode symbols. | |
* @returns {String} The resulting Punycode string of ASCII-only symbols. | |
*/ | |
function encode(input) { | |
var n, | |
delta, | |
handledCPCount, | |
basicLength, | |
bias, | |
j, | |
m, | |
q, | |
k, | |
t, | |
currentValue, | |
output = [], | |
/** `inputLength` will hold the number of code points in `input`. */ | |
inputLength, | |
/** Cached calculation results */ | |
handledCPCountPlusOne, | |
baseMinusT, | |
qMinusT; | |
// Convert the input in UCS-2 to Unicode | |
input = ucs2decode(input); | |
// Cache the length | |
inputLength = input.length; | |
// Initialize the state | |
n = initialN; | |
delta = 0; | |
bias = initialBias; | |
// Handle the basic code points | |
for (j = 0; j < inputLength; ++j) { | |
currentValue = input[j]; | |
if (currentValue < 0x80) { | |
output.push(stringFromCharCode(currentValue)); | |
} | |
} | |
handledCPCount = basicLength = output.length; | |
// `handledCPCount` is the number of code points that have been handled; | |
// `basicLength` is the number of basic code points. | |
// Finish the basic string - if it is not empty - with a delimiter | |
if (basicLength) { | |
output.push(delimiter); | |
} | |
// Main encoding loop: | |
while (handledCPCount < inputLength) { | |
// All non-basic code points < n have been handled already. Find the next | |
// larger one: | |
for (m = maxInt, j = 0; j < inputLength; ++j) { | |
currentValue = input[j]; | |
if (currentValue >= n && currentValue < m) { | |
m = currentValue; | |
} | |
} | |
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, | |
// but guard against overflow | |
handledCPCountPlusOne = handledCPCount + 1; | |
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { | |
error('overflow'); | |
} | |
delta += (m - n) * handledCPCountPlusOne; | |
n = m; | |
for (j = 0; j < inputLength; ++j) { | |
currentValue = input[j]; | |
if (currentValue < n && ++delta > maxInt) { | |
error('overflow'); | |
} | |
if (currentValue == n) { | |
// Represent delta as a generalized variable-length integer | |
for (q = delta, k = base; /* no condition */; k += base) { | |
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); | |
if (q < t) { | |
break; | |
} | |
qMinusT = q - t; | |
baseMinusT = base - t; | |
output.push( | |
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) | |
); | |
q = floor(qMinusT / baseMinusT); | |
} | |
output.push(stringFromCharCode(digitToBasic(q, 0))); | |
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); | |
delta = 0; | |
++handledCPCount; | |
} | |
} | |
++delta; | |
++n; | |
} | |
return output.join(''); | |
} | |
/** | |
* Converts a Punycode string representing a domain name to Unicode. Only the | |
* Punycoded parts of the domain name will be converted, i.e. it doesn't | |
* matter if you call it on a string that has already been converted to | |
* Unicode. | |
* @memberOf punycode | |
* @param {String} domain The Punycode domain name to convert to Unicode. | |
* @returns {String} The Unicode representation of the given Punycode | |
* string. | |
*/ | |
function toUnicode(domain) { | |
return mapDomain(domain, function(string) { | |
return regexPunycode.test(string) | |
? decode(string.slice(4).toLowerCase()) | |
: string; | |
}); | |
} | |
/** | |
* Converts a Unicode string representing a domain name to Punycode. Only the | |
* non-ASCII parts of the domain name will be converted, i.e. it doesn't | |
* matter if you call it with a domain that's already in ASCII. | |
* @memberOf punycode | |
* @param {String} domain The domain name to convert, as a Unicode string. | |
* @returns {String} The Punycode representation of the given domain name. | |
*/ | |
function toASCII(domain) { | |
return mapDomain(domain, function(string) { | |
return regexNonASCII.test(string) | |
? 'xn--' + encode(string) | |
: string; | |
}); | |
} | |
/*--------------------------------------------------------------------------*/ | |
/** Define the public API */ | |
punycode = { | |
/** | |
* A string representing the current Punycode.js version number. | |
* @memberOf punycode | |
* @type String | |
*/ | |
'version': '1.2.4', | |
/** | |
* An object of methods to convert from JavaScript's internal character | |
* representation (UCS-2) to Unicode code points, and back. | |
* @see <http://mathiasbynens.be/notes/javascript-encoding> | |
* @memberOf punycode | |
* @type Object | |
*/ | |
'ucs2': { | |
'decode': ucs2decode, | |
'encode': ucs2encode | |
}, | |
'decode': decode, | |
'encode': encode, | |
'toASCII': toASCII, | |
'toUnicode': toUnicode | |
}; | |
/** Expose `punycode` */ | |
// Some AMD build optimizers, like r.js, check for specific condition patterns | |
// like the following: | |
if ( | |
true | |
) { | |
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { | |
return punycode; | |
}.call(exports, __webpack_require__, exports, module)), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | |
} else if (freeExports && !freeExports.nodeType) { | |
if (freeModule) { // in Node.js or RingoJS v0.8.0+ | |
freeModule.exports = punycode; | |
} else { // in Narwhal or RingoJS v0.7.0- | |
for (key in punycode) { | |
punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); | |
} | |
} | |
} else { // in Rhino or a web browser | |
root.punycode = punycode; | |
} | |
}(this)); | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! (webpack)/buildin/module.js */ 27)(module), (function() { return this; }()))) | |
/***/ }, | |
/* 45 */ | |
/*!********************************************!*\ | |
!*** ./~/jsdom/~/htmlparser2/lib/index.js ***! | |
\********************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var Parser = __webpack_require__(/*! ./Parser.js */ 72), | |
DomHandler = __webpack_require__(/*! domhandler */ 88); | |
function defineProp(name, value){ | |
delete module.exports[name]; | |
module.exports[name] = value; | |
return value; | |
} | |
module.exports = { | |
Parser: Parser, | |
Tokenizer: __webpack_require__(/*! ./Tokenizer.js */ 73), | |
ElementType: __webpack_require__(/*! domelementtype */ 90), | |
DomHandler: DomHandler, | |
get FeedHandler(){ | |
return defineProp("FeedHandler", __webpack_require__(/*! ./FeedHandler.js */ 74)); | |
}, | |
get Stream(){ | |
return defineProp("Stream", __webpack_require__(/*! ./Stream.js */ 75)); | |
}, | |
get WritableStream(){ | |
return defineProp("WritableStream", __webpack_require__(/*! ./WritableStream.js */ 76)); | |
}, | |
get ProxyHandler(){ | |
return defineProp("ProxyHandler", __webpack_require__(/*! ./ProxyHandler.js */ 77)); | |
}, | |
get DomUtils(){ | |
return defineProp("DomUtils", __webpack_require__(/*! domutils */ 89)); | |
}, | |
get CollectingHandler(){ | |
return defineProp("CollectingHandler", __webpack_require__(/*! ./CollectingHandler.js */ 78)); | |
}, | |
// For legacy support | |
DefaultHandler: DomHandler, | |
get RssHandler(){ | |
return defineProp("RssHandler", this.FeedHandler); | |
}, | |
//helper methods | |
parseDOM: function(data, options) { | |
var handler = new DomHandler(options); | |
new Parser(handler, options).end(data); | |
return handler.dom; | |
}, | |
parseFeed: function(feed, options){ | |
var handler = new module.exports.FeedHandler(options); | |
new Parser(handler, options).end(feed); | |
return handler.dom; | |
}, | |
createDomStream: function(cb, options, elementCb){ | |
var handler = new DomHandler(cb, options, elementCb); | |
return new Parser(handler, options); | |
}, | |
// List of all events that the parser emits | |
EVENTS: { /* Format: eventname: number of arguments */ | |
attribute: 2, | |
cdatastart: 0, | |
cdataend: 0, | |
text: 1, | |
processinginstruction: 2, | |
comment: 1, | |
commentend: 0, | |
closetag: 1, | |
opentag: 2, | |
opentagname: 1, | |
error: 1, | |
end: 0 | |
} | |
}; | |
/***/ }, | |
/* 46 */ | |
/*!****************************************************!*\ | |
!*** ./~/jsdom/~/cssom/lib/CSSStyleDeclaration.js ***! | |
\****************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//.CommonJS | |
var CSSOM = {}; | |
///CommonJS | |
/** | |
* @constructor | |
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration | |
*/ | |
CSSOM.CSSStyleDeclaration = function CSSStyleDeclaration(){ | |
this.length = 0; | |
this.parentRule = null; | |
// NON-STANDARD | |
this._importants = {}; | |
}; | |
CSSOM.CSSStyleDeclaration.prototype = { | |
constructor: CSSOM.CSSStyleDeclaration, | |
/** | |
* | |
* @param {string} name | |
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-getPropertyValue | |
* @return {string} the value of the property if it has been explicitly set for this declaration block. | |
* Returns the empty string if the property has not been set. | |
*/ | |
getPropertyValue: function(name) { | |
return this[name] || ""; | |
}, | |
/** | |
* | |
* @param {string} name | |
* @param {string} value | |
* @param {string} [priority=null] "important" or null | |
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-setProperty | |
*/ | |
setProperty: function(name, value, priority) { | |
if (this[name]) { | |
// Property already exist. Overwrite it. | |
var index = Array.prototype.indexOf.call(this, name); | |
if (index < 0) { | |
this[this.length] = name; | |
this.length++; | |
} | |
} else { | |
// New property. | |
this[this.length] = name; | |
this.length++; | |
} | |
this[name] = value; | |
this._importants[name] = priority; | |
}, | |
/** | |
* | |
* @param {string} name | |
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-removeProperty | |
* @return {string} the value of the property if it has been explicitly set for this declaration block. | |
* Returns the empty string if the property has not been set or the property name does not correspond to a known CSS property. | |
*/ | |
removeProperty: function(name) { | |
if (!(name in this)) { | |
return ""; | |
} | |
var index = Array.prototype.indexOf.call(this, name); | |
if (index < 0) { | |
return ""; | |
} | |
var prevValue = this[name]; | |
this[name] = ""; | |
// That's what WebKit and Opera do | |
Array.prototype.splice.call(this, index, 1); | |
// That's what Firefox does | |
//this[index] = "" | |
return prevValue; | |
}, | |
getPropertyCSSValue: function() { | |
//FIXME | |
}, | |
/** | |
* | |
* @param {String} name | |
*/ | |
getPropertyPriority: function(name) { | |
return this._importants[name] || ""; | |
}, | |
/** | |
* element.style.overflow = "auto" | |
* element.style.getPropertyShorthand("overflow-x") | |
* -> "overflow" | |
*/ | |
getPropertyShorthand: function() { | |
//FIXME | |
}, | |
isPropertyImplicit: function() { | |
//FIXME | |
}, | |
// Doesn't work in IE < 9 | |
get cssText(){ | |
var properties = []; | |
for (var i=0, length=this.length; i < length; ++i) { | |
var name = this[i]; | |
var value = this.getPropertyValue(name); | |
var priority = this.getPropertyPriority(name); | |
if (priority) { | |
priority = " !" + priority; | |
} | |
properties[i] = name + ": " + value + priority + ";"; | |
} | |
return properties.join(" "); | |
}, | |
set cssText(cssText){ | |
var i, name; | |
for (i = this.length; i--;) { | |
name = this[i]; | |
this[name] = ""; | |
} | |
Array.prototype.splice.call(this, 0, this.length); | |
this._importants = {}; | |
var dummyRule = CSSOM.parse('#bogus{' + cssText + '}').cssRules[0].style; | |
var length = dummyRule.length; | |
for (i = 0; i < length; ++i) { | |
name = dummyRule[i]; | |
this.setProperty(dummyRule[i], dummyRule.getPropertyValue(name), dummyRule.getPropertyPriority(name)); | |
} | |
} | |
}; | |
//.CommonJS | |
exports.CSSStyleDeclaration = CSSOM.CSSStyleDeclaration; | |
CSSOM.parse = __webpack_require__(/*! ./parse */ 61).parse; // Cannot be included sooner due to the mutual dependency between parse.js and CSSStyleDeclaration.js | |
///CommonJS | |
/***/ }, | |
/* 47 */ | |
/*!****************************************!*\ | |
!*** ./~/jsdom/~/cssom/lib/CSSRule.js ***! | |
\****************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//.CommonJS | |
var CSSOM = {}; | |
///CommonJS | |
/** | |
* @constructor | |
* @see http://dev.w3.org/csswg/cssom/#the-cssrule-interface | |
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSRule | |
*/ | |
CSSOM.CSSRule = function CSSRule() { | |
this.parentRule = null; | |
this.parentStyleSheet = null; | |
}; | |
CSSOM.CSSRule.STYLE_RULE = 1; | |
CSSOM.CSSRule.IMPORT_RULE = 3; | |
CSSOM.CSSRule.MEDIA_RULE = 4; | |
CSSOM.CSSRule.FONT_FACE_RULE = 5; | |
CSSOM.CSSRule.PAGE_RULE = 6; | |
CSSOM.CSSRule.WEBKIT_KEYFRAMES_RULE = 8; | |
CSSOM.CSSRule.WEBKIT_KEYFRAME_RULE = 9; | |
// Obsolete in CSSOM http://dev.w3.org/csswg/cssom/ | |
//CSSOM.CSSRule.UNKNOWN_RULE = 0; | |
//CSSOM.CSSRule.CHARSET_RULE = 2; | |
// Never implemented | |
//CSSOM.CSSRule.VARIABLES_RULE = 7; | |
CSSOM.CSSRule.prototype = { | |
constructor: CSSOM.CSSRule | |
//FIXME | |
}; | |
//.CommonJS | |
exports.CSSRule = CSSOM.CSSRule; | |
///CommonJS | |
/***/ }, | |
/* 48 */ | |
/*!*********************************************!*\ | |
!*** ./~/jsdom/~/cssom/lib/CSSStyleRule.js ***! | |
\*********************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//.CommonJS | |
var CSSOM = { | |
CSSStyleDeclaration: __webpack_require__(/*! ./CSSStyleDeclaration */ 46).CSSStyleDeclaration, | |
CSSRule: __webpack_require__(/*! ./CSSRule */ 47).CSSRule | |
}; | |
///CommonJS | |
/** | |
* @constructor | |
* @see http://dev.w3.org/csswg/cssom/#cssstylerule | |
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleRule | |
*/ | |
CSSOM.CSSStyleRule = function CSSStyleRule() { | |
CSSOM.CSSRule.call(this); | |
this.selectorText = ""; | |
this.style = new CSSOM.CSSStyleDeclaration; | |
this.style.parentRule = this; | |
}; | |
CSSOM.CSSStyleRule.prototype = new CSSOM.CSSRule; | |
CSSOM.CSSStyleRule.prototype.constructor = CSSOM.CSSStyleRule; | |
CSSOM.CSSStyleRule.prototype.type = 1; | |
Object.defineProperty(CSSOM.CSSStyleRule.prototype, "cssText", { | |
get: function() { | |
var text; | |
if (this.selectorText) { | |
text = this.selectorText + " {" + this.style.cssText + "}"; | |
} else { | |
text = ""; | |
} | |
return text; | |
}, | |
set: function(cssText) { | |
var rule = CSSOM.CSSStyleRule.parse(cssText); | |
this.style = rule.style; | |
this.selectorText = rule.selectorText; | |
} | |
}); | |
/** | |
* NON-STANDARD | |
* lightweight version of parse.js. | |
* @param {string} ruleText | |
* @return CSSStyleRule | |
*/ | |
CSSOM.CSSStyleRule.parse = function(ruleText) { | |
var i = 0; | |
var state = "selector"; | |
var index; | |
var j = i; | |
var buffer = ""; | |
var SIGNIFICANT_WHITESPACE = { | |
"selector": true, | |
"value": true | |
}; | |
var styleRule = new CSSOM.CSSStyleRule; | |
var selector, name, value, priority=""; | |
for (var character; character = ruleText.charAt(i); i++) { | |
switch (character) { | |
case " ": | |
case "\t": | |
case "\r": | |
case "\n": | |
case "\f": | |
if (SIGNIFICANT_WHITESPACE[state]) { | |
// Squash 2 or more white-spaces in the row into 1 | |
switch (ruleText.charAt(i - 1)) { | |
case " ": | |
case "\t": | |
case "\r": | |
case "\n": | |
case "\f": | |
break; | |
default: | |
buffer += " "; | |
break; | |
} | |
} | |
break; | |
// String | |
case '"': | |
j = i + 1; | |
index = ruleText.indexOf('"', j) + 1; | |
if (!index) { | |
throw '" is missing'; | |
} | |
buffer += ruleText.slice(i, index); | |
i = index - 1; | |
break; | |
case "'": | |
j = i + 1; | |
index = ruleText.indexOf("'", j) + 1; | |
if (!index) { | |
throw "' is missing"; | |
} | |
buffer += ruleText.slice(i, index); | |
i = index - 1; | |
break; | |
// Comment | |
case "/": | |
if (ruleText.charAt(i + 1) === "*") { | |
i += 2; | |
index = ruleText.indexOf("*/", i); | |
if (index === -1) { | |
throw new SyntaxError("Missing */"); | |
} else { | |
i = index + 1; | |
} | |
} else { | |
buffer += character; | |
} | |
break; | |
case "{": | |
if (state === "selector") { | |
styleRule.selectorText = buffer.trim(); | |
buffer = ""; | |
state = "name"; | |
} | |
break; | |
case ":": | |
if (state === "name") { | |
name = buffer.trim(); | |
buffer = ""; | |
state = "value"; | |
} else { | |
buffer += character; | |
} | |
break; | |
case "!": | |
if (state === "value" && ruleText.indexOf("!important", i) === i) { | |
priority = "important"; | |
i += "important".length; | |
} else { | |
buffer += character; | |
} | |
break; | |
case ";": | |
if (state === "value") { | |
styleRule.style.setProperty(name, buffer.trim(), priority); | |
priority = ""; | |
buffer = ""; | |
state = "name"; | |
} else { | |
buffer += character; | |
} | |
break; | |
case "}": | |
if (state === "value") { | |
styleRule.style.setProperty(name, buffer.trim(), priority); | |
priority = ""; | |
buffer = ""; | |
} else if (state === "name") { | |
break; | |
} else { | |
buffer += character; | |
} | |
state = "selector"; | |
break; | |
default: | |
buffer += character; | |
break; | |
} | |
} | |
return styleRule; | |
}; | |
//.CommonJS | |
exports.CSSStyleRule = CSSOM.CSSStyleRule; | |
///CommonJS | |
/***/ }, | |
/* 49 */ | |
/*!******************************************!*\ | |
!*** ./~/jsdom/~/cssom/lib/MediaList.js ***! | |
\******************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//.CommonJS | |
var CSSOM = {}; | |
///CommonJS | |
/** | |
* @constructor | |
* @see http://dev.w3.org/csswg/cssom/#the-medialist-interface | |
*/ | |
CSSOM.MediaList = function MediaList(){ | |
this.length = 0; | |
}; | |
CSSOM.MediaList.prototype = { | |
constructor: CSSOM.MediaList, | |
/** | |
* @return {string} | |
*/ | |
get mediaText() { | |
return Array.prototype.join.call(this, ", "); | |
}, | |
/** | |
* @param {string} value | |
*/ | |
set mediaText(value) { | |
var values = value.split(","); | |
var length = this.length = values.length; | |
for (var i=0; i<length; i++) { | |
this[i] = values[i].trim(); | |
} | |
}, | |
/** | |
* @param {string} medium | |
*/ | |
appendMedium: function(medium) { | |
if (Array.prototype.indexOf.call(this, medium) === -1) { | |
this[this.length] = medium; | |
this.length++; | |
} | |
}, | |
/** | |
* @param {string} medium | |
*/ | |
deleteMedium: function(medium) { | |
var index = Array.prototype.indexOf.call(this, medium); | |
if (index !== -1) { | |
Array.prototype.splice.call(this, index, 1); | |
} | |
} | |
}; | |
//.CommonJS | |
exports.MediaList = CSSOM.MediaList; | |
///CommonJS | |
/***/ }, | |
/* 50 */ | |
/*!*********************************************!*\ | |
!*** ./~/jsdom/~/cssom/lib/CSSMediaRule.js ***! | |
\*********************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//.CommonJS | |
var CSSOM = { | |
CSSRule: __webpack_require__(/*! ./CSSRule */ 47).CSSRule, | |
MediaList: __webpack_require__(/*! ./MediaList */ 49).MediaList | |
}; | |
///CommonJS | |
/** | |
* @constructor | |
* @see http://dev.w3.org/csswg/cssom/#cssmediarule | |
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSMediaRule | |
*/ | |
CSSOM.CSSMediaRule = function CSSMediaRule() { | |
CSSOM.CSSRule.call(this); | |
this.media = new CSSOM.MediaList; | |
this.cssRules = []; | |
}; | |
CSSOM.CSSMediaRule.prototype = new CSSOM.CSSRule; | |
CSSOM.CSSMediaRule.prototype.constructor = CSSOM.CSSMediaRule; | |
CSSOM.CSSMediaRule.prototype.type = 4; | |
//FIXME | |
//CSSOM.CSSMediaRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule; | |
//CSSOM.CSSMediaRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule; | |
// http://opensource.apple.com/source/WebCore/WebCore-658.28/css/CSSMediaRule.cpp | |
Object.defineProperty(CSSOM.CSSMediaRule.prototype, "cssText", { | |
get: function() { | |
var cssTexts = []; | |
for (var i=0, length=this.cssRules.length; i < length; i++) { | |
cssTexts.push(this.cssRules[i].cssText); | |
} | |
return "@media " + this.media.mediaText + " {" + cssTexts.join("") + "}"; | |
} | |
}); | |
//.CommonJS | |
exports.CSSMediaRule = CSSOM.CSSMediaRule; | |
///CommonJS | |
/***/ }, | |
/* 51 */ | |
/*!**********************************************!*\ | |
!*** ./~/jsdom/~/cssom/lib/CSSImportRule.js ***! | |
\**********************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//.CommonJS | |
var CSSOM = { | |
CSSRule: __webpack_require__(/*! ./CSSRule */ 47).CSSRule, | |
CSSStyleSheet: __webpack_require__(/*! ./CSSStyleSheet */ 54).CSSStyleSheet, | |
MediaList: __webpack_require__(/*! ./MediaList */ 49).MediaList | |
}; | |
///CommonJS | |
/** | |
* @constructor | |
* @see http://dev.w3.org/csswg/cssom/#cssimportrule | |
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSImportRule | |
*/ | |
CSSOM.CSSImportRule = function CSSImportRule() { | |
CSSOM.CSSRule.call(this); | |
this.href = ""; | |
this.media = new CSSOM.MediaList; | |
this.styleSheet = new CSSOM.CSSStyleSheet; | |
}; | |
CSSOM.CSSImportRule.prototype = new CSSOM.CSSRule; | |
CSSOM.CSSImportRule.prototype.constructor = CSSOM.CSSImportRule; | |
CSSOM.CSSImportRule.prototype.type = 3; | |
Object.defineProperty(CSSOM.CSSImportRule.prototype, "cssText", { | |
get: function() { | |
var mediaText = this.media.mediaText; | |
return "@import url(" + this.href + ")" + (mediaText ? " " + mediaText : "") + ";"; | |
}, | |
set: function(cssText) { | |
var i = 0; | |
/** | |
* @import url(partial.css) screen, handheld; | |
* || | | |
* after-import media | |
* | | |
* url | |
*/ | |
var state = ''; | |
var buffer = ''; | |
var index; | |
var mediaText = ''; | |
for (var character; character = cssText.charAt(i); i++) { | |
switch (character) { | |
case ' ': | |
case '\t': | |
case '\r': | |
case '\n': | |
case '\f': | |
if (state === 'after-import') { | |
state = 'url'; | |
} else { | |
buffer += character; | |
} | |
break; | |
case '@': | |
if (!state && cssText.indexOf('@import', i) === i) { | |
state = 'after-import'; | |
i += 'import'.length; | |
buffer = ''; | |
} | |
break; | |
case 'u': | |
if (state === 'url' && cssText.indexOf('url(', i) === i) { | |
index = cssText.indexOf(')', i + 1); | |
if (index === -1) { | |
throw i + ': ")" not found'; | |
} | |
i += 'url('.length; | |
var url = cssText.slice(i, index); | |
if (url[0] === url[url.length - 1]) { | |
if (url[0] === '"' || url[0] === "'") { | |
url = url.slice(1, -1); | |
} | |
} | |
this.href = url; | |
i = index; | |
state = 'media'; | |
} | |
break; | |
case '"': | |
if (state === 'url') { | |
index = cssText.indexOf('"', i + 1); | |
if (!index) { | |
throw i + ": '\"' not found"; | |
} | |
this.href = cssText.slice(i + 1, index); | |
i = index; | |
state = 'media'; | |
} | |
break; | |
case "'": | |
if (state === 'url') { | |
index = cssText.indexOf("'", i + 1); | |
if (!index) { | |
throw i + ': "\'" not found'; | |
} | |
this.href = cssText.slice(i + 1, index); | |
i = index; | |
state = 'media'; | |
} | |
break; | |
case ';': | |
if (state === 'media') { | |
if (buffer) { | |
this.media.mediaText = buffer.trim(); | |
} | |
} | |
break; | |
default: | |
if (state === 'media') { | |
buffer += character; | |
} | |
break; | |
} | |
} | |
} | |
}); | |
//.CommonJS | |
exports.CSSImportRule = CSSOM.CSSImportRule; | |
///CommonJS | |
/***/ }, | |
/* 52 */ | |
/*!************************************************!*\ | |
!*** ./~/jsdom/~/cssom/lib/CSSFontFaceRule.js ***! | |
\************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//.CommonJS | |
var CSSOM = { | |
CSSStyleDeclaration: __webpack_require__(/*! ./CSSStyleDeclaration */ 46).CSSStyleDeclaration, | |
CSSRule: __webpack_require__(/*! ./CSSRule */ 47).CSSRule | |
}; | |
///CommonJS | |
/** | |
* @constructor | |
* @see http://dev.w3.org/csswg/cssom/#css-font-face-rule | |
*/ | |
CSSOM.CSSFontFaceRule = function CSSFontFaceRule() { | |
CSSOM.CSSRule.call(this); | |
this.style = new CSSOM.CSSStyleDeclaration; | |
this.style.parentRule = this; | |
}; | |
CSSOM.CSSFontFaceRule.prototype = new CSSOM.CSSRule; | |
CSSOM.CSSFontFaceRule.prototype.constructor = CSSOM.CSSFontFaceRule; | |
CSSOM.CSSFontFaceRule.prototype.type = 5; | |
//FIXME | |
//CSSOM.CSSFontFaceRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule; | |
//CSSOM.CSSFontFaceRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule; | |
// http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSFontFaceRule.cpp | |
Object.defineProperty(CSSOM.CSSFontFaceRule.prototype, "cssText", { | |
get: function() { | |
return "@font-face {" + this.style.cssText + "}"; | |
} | |
}); | |
//.CommonJS | |
exports.CSSFontFaceRule = CSSOM.CSSFontFaceRule; | |
///CommonJS | |
/***/ }, | |
/* 53 */ | |
/*!*******************************************!*\ | |
!*** ./~/jsdom/~/cssom/lib/StyleSheet.js ***! | |
\*******************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//.CommonJS | |
var CSSOM = {}; | |
///CommonJS | |
/** | |
* @constructor | |
* @see http://dev.w3.org/csswg/cssom/#the-stylesheet-interface | |
*/ | |
CSSOM.StyleSheet = function StyleSheet() { | |
this.parentStyleSheet = null; | |
}; | |
//.CommonJS | |
exports.StyleSheet = CSSOM.StyleSheet; | |
///CommonJS | |
/***/ }, | |
/* 54 */ | |
/*!**********************************************!*\ | |
!*** ./~/jsdom/~/cssom/lib/CSSStyleSheet.js ***! | |
\**********************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//.CommonJS | |
var CSSOM = { | |
StyleSheet: __webpack_require__(/*! ./StyleSheet */ 53).StyleSheet, | |
CSSStyleRule: __webpack_require__(/*! ./CSSStyleRule */ 48).CSSStyleRule | |
}; | |
///CommonJS | |
/** | |
* @constructor | |
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleSheet | |
*/ | |
CSSOM.CSSStyleSheet = function CSSStyleSheet() { | |
CSSOM.StyleSheet.call(this); | |
this.cssRules = []; | |
}; | |
CSSOM.CSSStyleSheet.prototype = new CSSOM.StyleSheet; | |
CSSOM.CSSStyleSheet.prototype.constructor = CSSOM.CSSStyleSheet; | |
/** | |
* Used to insert a new rule into the style sheet. The new rule now becomes part of the cascade. | |
* | |
* sheet = new Sheet("body {margin: 0}") | |
* sheet.toString() | |
* -> "body{margin:0;}" | |
* sheet.insertRule("img {border: none}", 0) | |
* -> 0 | |
* sheet.toString() | |
* -> "img{border:none;}body{margin:0;}" | |
* | |
* @param {string} rule | |
* @param {number} index | |
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleSheet-insertRule | |
* @return {number} The index within the style sheet's rule collection of the newly inserted rule. | |
*/ | |
CSSOM.CSSStyleSheet.prototype.insertRule = function(rule, index) { | |
if (index < 0 || index > this.cssRules.length) { | |
throw new RangeError("INDEX_SIZE_ERR"); | |
} | |
var cssRule = CSSOM.parse(rule).cssRules[0]; | |
cssRule.parentStyleSheet = this; | |
this.cssRules.splice(index, 0, cssRule); | |
return index; | |
}; | |
/** | |
* Used to delete a rule from the style sheet. | |
* | |
* sheet = new Sheet("img{border:none} body{margin:0}") | |
* sheet.toString() | |
* -> "img{border:none;}body{margin:0;}" | |
* sheet.deleteRule(0) | |
* sheet.toString() | |
* -> "body{margin:0;}" | |
* | |
* @param {number} index within the style sheet's rule list of the rule to remove. | |
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleSheet-deleteRule | |
*/ | |
CSSOM.CSSStyleSheet.prototype.deleteRule = function(index) { | |
if (index < 0 || index >= this.cssRules.length) { | |
throw new RangeError("INDEX_SIZE_ERR"); | |
} | |
this.cssRules.splice(index, 1); | |
}; | |
/** | |
* NON-STANDARD | |
* @return {string} serialize stylesheet | |
*/ | |
CSSOM.CSSStyleSheet.prototype.toString = function() { | |
var result = ""; | |
var rules = this.cssRules; | |
for (var i=0; i<rules.length; i++) { | |
result += rules[i].cssText + "\n"; | |
} | |
return result; | |
}; | |
//.CommonJS | |
exports.CSSStyleSheet = CSSOM.CSSStyleSheet; | |
CSSOM.parse = __webpack_require__(/*! ./parse */ 61).parse; // Cannot be included sooner due to the mutual dependency between parse.js and CSSStyleSheet.js | |
///CommonJS | |
/***/ }, | |
/* 55 */ | |
/*!*************************************************!*\ | |
!*** ./~/jsdom/~/cssom/lib/CSSKeyframesRule.js ***! | |
\*************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//.CommonJS | |
var CSSOM = { | |
CSSRule: __webpack_require__(/*! ./CSSRule */ 47).CSSRule | |
}; | |
///CommonJS | |
/** | |
* @constructor | |
* @see http://www.w3.org/TR/css3-animations/#DOM-CSSKeyframesRule | |
*/ | |
CSSOM.CSSKeyframesRule = function CSSKeyframesRule() { | |
CSSOM.CSSRule.call(this); | |
this.name = ''; | |
this.cssRules = []; | |
}; | |
CSSOM.CSSKeyframesRule.prototype = new CSSOM.CSSRule; | |
CSSOM.CSSKeyframesRule.prototype.constructor = CSSOM.CSSKeyframesRule; | |
CSSOM.CSSKeyframesRule.prototype.type = 8; | |
//FIXME | |
//CSSOM.CSSKeyframesRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule; | |
//CSSOM.CSSKeyframesRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule; | |
// http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSKeyframesRule.cpp | |
Object.defineProperty(CSSOM.CSSKeyframesRule.prototype, "cssText", { | |
get: function() { | |
var cssTexts = []; | |
for (var i=0, length=this.cssRules.length; i < length; i++) { | |
cssTexts.push(" " + this.cssRules[i].cssText); | |
} | |
return "@" + (this._vendorPrefix || '') + "keyframes " + this.name + " { \n" + cssTexts.join("\n") + "\n}"; | |
} | |
}); | |
//.CommonJS | |
exports.CSSKeyframesRule = CSSOM.CSSKeyframesRule; | |
///CommonJS | |
/***/ }, | |
/* 56 */ | |
/*!************************************************!*\ | |
!*** ./~/jsdom/~/cssom/lib/CSSKeyframeRule.js ***! | |
\************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//.CommonJS | |
var CSSOM = { | |
CSSRule: __webpack_require__(/*! ./CSSRule */ 47).CSSRule, | |
CSSStyleDeclaration: __webpack_require__(/*! ./CSSStyleDeclaration */ 46).CSSStyleDeclaration | |
}; | |
///CommonJS | |
/** | |
* @constructor | |
* @see http://www.w3.org/TR/css3-animations/#DOM-CSSKeyframeRule | |
*/ | |
CSSOM.CSSKeyframeRule = function CSSKeyframeRule() { | |
CSSOM.CSSRule.call(this); | |
this.keyText = ''; | |
this.style = new CSSOM.CSSStyleDeclaration; | |
this.style.parentRule = this; | |
}; | |
CSSOM.CSSKeyframeRule.prototype = new CSSOM.CSSRule; | |
CSSOM.CSSKeyframeRule.prototype.constructor = CSSOM.CSSKeyframeRule; | |
CSSOM.CSSKeyframeRule.prototype.type = 9; | |
//FIXME | |
//CSSOM.CSSKeyframeRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule; | |
//CSSOM.CSSKeyframeRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule; | |
// http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSKeyframeRule.cpp | |
Object.defineProperty(CSSOM.CSSKeyframeRule.prototype, "cssText", { | |
get: function() { | |
return this.keyText + " {" + this.style.cssText + "} "; | |
} | |
}); | |
//.CommonJS | |
exports.CSSKeyframeRule = CSSOM.CSSKeyframeRule; | |
///CommonJS | |
/***/ }, | |
/* 57 */ | |
/*!********************************************!*\ | |
!*** ./~/jsdom/~/cssom/lib/MatcherList.js ***! | |
\********************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//.CommonJS | |
var CSSOM = {}; | |
///CommonJS | |
/** | |
* @constructor | |
* @see https://developer.mozilla.org/en/CSS/@-moz-document | |
*/ | |
CSSOM.MatcherList = function MatcherList(){ | |
this.length = 0; | |
}; | |
CSSOM.MatcherList.prototype = { | |
constructor: CSSOM.MatcherList, | |
/** | |
* @return {string} | |
*/ | |
get matcherText() { | |
return Array.prototype.join.call(this, ", "); | |
}, | |
/** | |
* @param {string} value | |
*/ | |
set matcherText(value) { | |
// just a temporary solution, actually it may be wrong by just split the value with ',', because a url can include ','. | |
var values = value.split(","); | |
var length = this.length = values.length; | |
for (var i=0; i<length; i++) { | |
this[i] = values[i].trim(); | |
} | |
}, | |
/** | |
* @param {string} matcher | |
*/ | |
appendMatcher: function(matcher) { | |
if (Array.prototype.indexOf.call(this, matcher) === -1) { | |
this[this.length] = matcher; | |
this.length++; | |
} | |
}, | |
/** | |
* @param {string} matcher | |
*/ | |
deleteMatcher: function(matcher) { | |
var index = Array.prototype.indexOf.call(this, matcher); | |
if (index !== -1) { | |
Array.prototype.splice.call(this, index, 1); | |
} | |
} | |
}; | |
//.CommonJS | |
exports.MatcherList = CSSOM.MatcherList; | |
///CommonJS | |
/***/ }, | |
/* 58 */ | |
/*!************************************************!*\ | |
!*** ./~/jsdom/~/cssom/lib/CSSDocumentRule.js ***! | |
\************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//.CommonJS | |
var CSSOM = { | |
CSSRule: __webpack_require__(/*! ./CSSRule */ 47).CSSRule, | |
MatcherList: __webpack_require__(/*! ./MatcherList */ 57).MatcherList | |
}; | |
///CommonJS | |
/** | |
* @constructor | |
* @see https://developer.mozilla.org/en/CSS/@-moz-document | |
*/ | |
CSSOM.CSSDocumentRule = function CSSDocumentRule() { | |
CSSOM.CSSRule.call(this); | |
this.matcher = new CSSOM.MatcherList; | |
this.cssRules = []; | |
}; | |
CSSOM.CSSDocumentRule.prototype = new CSSOM.CSSRule; | |
CSSOM.CSSDocumentRule.prototype.constructor = CSSOM.CSSDocumentRule; | |
CSSOM.CSSDocumentRule.prototype.type = 10; | |
//FIXME | |
//CSSOM.CSSDocumentRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule; | |
//CSSOM.CSSDocumentRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule; | |
Object.defineProperty(CSSOM.CSSDocumentRule.prototype, "cssText", { | |
get: function() { | |
var cssTexts = []; | |
for (var i=0, length=this.cssRules.length; i < length; i++) { | |
cssTexts.push(this.cssRules[i].cssText); | |
} | |
return "@-moz-document " + this.matcher.matcherText + " {" + cssTexts.join("") + "}"; | |
} | |
}); | |
//.CommonJS | |
exports.CSSDocumentRule = CSSOM.CSSDocumentRule; | |
///CommonJS | |
/***/ }, | |
/* 59 */ | |
/*!*****************************************!*\ | |
!*** ./~/jsdom/~/cssom/lib/CSSValue.js ***! | |
\*****************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//.CommonJS | |
var CSSOM = {}; | |
///CommonJS | |
/** | |
* @constructor | |
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSValue | |
* | |
* TODO: add if needed | |
*/ | |
CSSOM.CSSValue = function CSSValue() { | |
}; | |
CSSOM.CSSValue.prototype = { | |
constructor: CSSOM.CSSValue, | |
// @see: http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSValue | |
set cssText(text) { | |
var name = this._getConstructorName(); | |
throw new Exception('DOMException: property "cssText" of "' + name + '" is readonly!'); | |
}, | |
get cssText() { | |
var name = this._getConstructorName(); | |
throw new Exception('getter "cssText" of "' + name + '" is not implemented!'); | |
}, | |
_getConstructorName: function() { | |
var s = this.constructor.toString(), | |
c = s.match(/function\s([^\(]+)/), | |
name = c[1]; | |
return name; | |
} | |
}; | |
//.CommonJS | |
exports.CSSValue = CSSOM.CSSValue; | |
///CommonJS | |
/***/ }, | |
/* 60 */ | |
/*!***************************************************!*\ | |
!*** ./~/jsdom/~/cssom/lib/CSSValueExpression.js ***! | |
\***************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//.CommonJS | |
var CSSOM = { | |
CSSValue: __webpack_require__(/*! ./CSSValue */ 59).CSSValue | |
}; | |
///CommonJS | |
/** | |
* @constructor | |
* @see http://msdn.microsoft.com/en-us/library/ms537634(v=vs.85).aspx | |
* | |
*/ | |
CSSOM.CSSValueExpression = function CSSValueExpression(token, idx) { | |
this._token = token; | |
this._idx = idx; | |
}; | |
CSSOM.CSSValueExpression.prototype = new CSSOM.CSSValue; | |
CSSOM.CSSValueExpression.prototype.constructor = CSSOM.CSSValueExpression; | |
/** | |
* parse css expression() value | |
* | |
* @return {Object} | |
* - error: | |
* or | |
* - idx: | |
* - expression: | |
* | |
* Example: | |
* | |
* .selector { | |
* zoom: expression(documentElement.clientWidth > 1000 ? '1000px' : 'auto'); | |
* } | |
*/ | |
CSSOM.CSSValueExpression.prototype.parse = function() { | |
var token = this._token, | |
idx = this._idx; | |
var character = '', | |
expression = '', | |
error = '', | |
info, | |
paren = []; | |
for (; ; ++idx) { | |
character = token.charAt(idx); | |
// end of token | |
if (character == '') { | |
error = 'css expression error: unfinished expression!'; | |
break; | |
} | |
switch(character) { | |
case '(': | |
paren.push(character); | |
expression += character; | |
break; | |
case ')': | |
paren.pop(character); | |
expression += character; | |
break; | |
case '/': | |
if (info = this._parseJSComment(token, idx)) { // comment? | |
if (info.error) { | |
error = 'css expression error: unfinished comment in expression!'; | |
} else { | |
idx = info.idx; | |
// ignore the comment | |
} | |
} else if (info = this._parseJSRexExp(token, idx)) { // regexp | |
idx = info.idx; | |
expression += info.text; | |
} else { // other | |
expression += character; | |
} | |
break; | |
case "'": | |
case '"': | |
info = this._parseJSString(token, idx, character); | |
if (info) { // string | |
idx = info.idx; | |
expression += info.text; | |
} else { | |
expression += character; | |
} | |
break; | |
default: | |
expression += character; | |
break; | |
} | |
if (error) { | |
break; | |
} | |
// end of expression | |
if (paren.length == 0) { | |
break; | |
} | |
} | |
var ret; | |
if (error) { | |
ret = { | |
error: error | |
} | |
} else { | |
ret = { | |
idx: idx, | |
expression: expression | |
} | |
} | |
return ret; | |
}; | |
/** | |
* | |
* @return {Object|false} | |
* - idx: | |
* - text: | |
* or | |
* - error: | |
* or | |
* false | |
* | |
*/ | |
CSSOM.CSSValueExpression.prototype._parseJSComment = function(token, idx) { | |
var nextChar = token.charAt(idx + 1), | |
text; | |
if (nextChar == '/' || nextChar == '*') { | |
var startIdx = idx, | |
endIdx, | |
commentEndChar; | |
if (nextChar == '/') { // line comment | |
commentEndChar = '\n'; | |
} else if (nextChar == '*') { // block comment | |
commentEndChar = '*/'; | |
} | |
endIdx = token.indexOf(commentEndChar, startIdx + 1 + 1); | |
if (endIdx !== -1) { | |
endIdx = endIdx + commentEndChar.length - 1; | |
text = token.substring(idx, endIdx + 1); | |
return { | |
idx: endIdx, | |
text: text | |
} | |
} else { | |
error = 'css expression error: unfinished comment in expression!'; | |
return { | |
error: error | |
} | |
} | |
} else { | |
return false; | |
} | |
}; | |
/** | |
* | |
* @return {Object|false} | |
* - idx: | |
* - text: | |
* or | |
* false | |
* | |
*/ | |
CSSOM.CSSValueExpression.prototype._parseJSString = function(token, idx, sep) { | |
var endIdx = this._findMatchedIdx(token, idx, sep), | |
text; | |
if (endIdx === -1) { | |
return false; | |
} else { | |
text = token.substring(idx, endIdx + sep.length); | |
return { | |
idx: endIdx, | |
text: text | |
} | |
} | |
}; | |
/** | |
* parse regexp in css expression | |
* | |
* @return {Object|false} | |
* - idx: | |
* - regExp: | |
* or | |
* false | |
*/ | |
/* | |
all legal RegExp | |
/a/ | |
(/a/) | |
[/a/] | |
[12, /a/] | |
!/a/ | |
+/a/ | |
-/a/ | |
* /a/ | |
/ /a/ | |
%/a/ | |
===/a/ | |
!==/a/ | |
==/a/ | |
!=/a/ | |
>/a/ | |
>=/a/ | |
</a/ | |
<=/a/ | |
&/a/ | |
|/a/ | |
^/a/ | |
~/a/ | |
<</a/ | |
>>/a/ | |
>>>/a/ | |
&&/a/ | |
||/a/ | |
?/a/ | |
=/a/ | |
,/a/ | |
delete /a/ | |
in /a/ | |
instanceof /a/ | |
new /a/ | |
typeof /a/ | |
void /a/ | |
*/ | |
CSSOM.CSSValueExpression.prototype._parseJSRexExp = function(token, idx) { | |
var before = token.substring(0, idx).replace(/\s+$/, ""), | |
legalRegx = [ | |
/^$/, | |
/\($/, | |
/\[$/, | |
/\!$/, | |
/\+$/, | |
/\-$/, | |
/\*$/, | |
/\/\s+/, | |
/\%$/, | |
/\=$/, | |
/\>$/, | |
/\<$/, | |
/\&$/, | |
/\|$/, | |
/\^$/, | |
/\~$/, | |
/\?$/, | |
/\,$/, | |
/delete$/, | |
/in$/, | |
/instanceof$/, | |
/new$/, | |
/typeof$/, | |
/void$/, | |
]; | |
var isLegal = legalRegx.some(function(reg) { | |
return reg.test(before); | |
}); | |
if (!isLegal) { | |
return false; | |
} else { | |
var sep = '/'; | |
// same logic as string | |
return this._parseJSString(token, idx, sep); | |
} | |
}; | |
/** | |
* | |
* find next sep(same line) index in `token` | |
* | |
* @return {Number} | |
* | |
*/ | |
CSSOM.CSSValueExpression.prototype._findMatchedIdx = function(token, idx, sep) { | |
var startIdx = idx, | |
endIdx; | |
var NOT_FOUND = -1; | |
while(true) { | |
endIdx = token.indexOf(sep, startIdx + 1); | |
if (endIdx === -1) { // not found | |
endIdx = NOT_FOUND; | |
break; | |
} else { | |
var text = token.substring(idx + 1, endIdx), | |
matched = text.match(/\\+$/); | |
if (!matched || matched[0] % 2 == 0) { // not escaped | |
break; | |
} else { | |
startIdx = endIdx; | |
} | |
} | |
} | |
// boundary must be in the same line(js sting or regexp) | |
var nextNewLineIdx = token.indexOf('\n', idx + 1); | |
if (nextNewLineIdx < endIdx) { | |
endIdx = NOT_FOUND; | |
} | |
return endIdx; | |
} | |
//.CommonJS | |
exports.CSSValueExpression = CSSOM.CSSValueExpression; | |
///CommonJS | |
/***/ }, | |
/* 61 */ | |
/*!**************************************!*\ | |
!*** ./~/jsdom/~/cssom/lib/parse.js ***! | |
\**************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//.CommonJS | |
var CSSOM = {}; | |
///CommonJS | |
/** | |
* @param {string} token | |
*/ | |
CSSOM.parse = function parse(token) { | |
var i = 0; | |
/** | |
"before-selector" or | |
"selector" or | |
"atRule" or | |
"atBlock" or | |
"before-name" or | |
"name" or | |
"before-value" or | |
"value" | |
*/ | |
var state = "before-selector"; | |
var index; | |
var buffer = ""; | |
var SIGNIFICANT_WHITESPACE = { | |
"selector": true, | |
"value": true, | |
"atRule": true, | |
"importRule-begin": true, | |
"importRule": true, | |
"atBlock": true, | |
'documentRule-begin': true | |
}; | |
var styleSheet = new CSSOM.CSSStyleSheet; | |
// @type CSSStyleSheet|CSSMediaRule|CSSFontFaceRule|CSSKeyframesRule|CSSDocumentRule | |
var currentScope = styleSheet; | |
// @type CSSMediaRule|CSSKeyframesRule|CSSDocumentRule | |
var parentRule; | |
var selector, name, value, priority="", styleRule, mediaRule, importRule, fontFaceRule, keyframesRule, keyframeRule, documentRule; | |
var atKeyframesRegExp = /@(-(?:\w+-)+)?keyframes/g; | |
var parseError = function(message) { | |
var lines = token.substring(0, i).split('\n'); | |
var lineCount = lines.length; | |
var charCount = lines.pop().length + 1; | |
var error = new Error(message + ' (line ' + lineCount + ', char ' + charCount + ')'); | |
error.line = lineCount; | |
error.char = charCount; | |
error.styleSheet = styleSheet; | |
throw error; | |
}; | |
for (var character; character = token.charAt(i); i++) { | |
switch (character) { | |
case " ": | |
case "\t": | |
case "\r": | |
case "\n": | |
case "\f": | |
if (SIGNIFICANT_WHITESPACE[state]) { | |
buffer += character; | |
} | |
break; | |
// String | |
case '"': | |
index = i + 1; | |
do { | |
index = token.indexOf('"', index) + 1; | |
if (!index) { | |
parseError('Unmatched "'); | |
} | |
} while (token[index - 2] === '\\') | |
buffer += token.slice(i, index); | |
i = index - 1; | |
switch (state) { | |
case 'before-value': | |
state = 'value'; | |
break; | |
case 'importRule-begin': | |
state = 'importRule'; | |
break; | |
} | |
break; | |
case "'": | |
index = i + 1; | |
do { | |
index = token.indexOf("'", index) + 1; | |
if (!index) { | |
parseError("Unmatched '"); | |
} | |
} while (token[index - 2] === '\\') | |
buffer += token.slice(i, index); | |
i = index - 1; | |
switch (state) { | |
case 'before-value': | |
state = 'value'; | |
break; | |
case 'importRule-begin': | |
state = 'importRule'; | |
break; | |
} | |
break; | |
// Comment | |
case "/": | |
if (token.charAt(i + 1) === "*") { | |
i += 2; | |
index = token.indexOf("*/", i); | |
if (index === -1) { | |
parseError("Missing */"); | |
} else { | |
i = index + 1; | |
} | |
} else { | |
buffer += character; | |
} | |
if (state === "importRule-begin") { | |
buffer += " "; | |
state = "importRule"; | |
} | |
break; | |
// At-rule | |
case "@": | |
if (token.indexOf("@-moz-document", i) === i) { | |
state = "documentRule-begin"; | |
documentRule = new CSSOM.CSSDocumentRule; | |
documentRule.__starts = i; | |
i += "-moz-document".length; | |
buffer = ""; | |
break; | |
} else if (token.indexOf("@media", i) === i) { | |
state = "atBlock"; | |
mediaRule = new CSSOM.CSSMediaRule; | |
mediaRule.__starts = i; | |
i += "media".length; | |
buffer = ""; | |
break; | |
} else if (token.indexOf("@import", i) === i) { | |
state = "importRule-begin"; | |
i += "import".length; | |
buffer += "@import"; | |
break; | |
} else if (token.indexOf("@font-face", i) === i) { | |
state = "fontFaceRule-begin"; | |
i += "font-face".length; | |
fontFaceRule = new CSSOM.CSSFontFaceRule; | |
fontFaceRule.__starts = i; | |
buffer = ""; | |
break; | |
} else { | |
atKeyframesRegExp.lastIndex = i; | |
var matchKeyframes = atKeyframesRegExp.exec(token); | |
if (matchKeyframes && matchKeyframes.index === i) { | |
state = "keyframesRule-begin"; | |
keyframesRule = new CSSOM.CSSKeyframesRule; | |
keyframesRule.__starts = i; | |
keyframesRule._vendorPrefix = matchKeyframes[1]; // Will come out as undefined if no prefix was found | |
i += matchKeyframes[0].length - 1; | |
buffer = ""; | |
break; | |
} else if (state == "selector") { | |
state = "atRule"; | |
} | |
} | |
buffer += character; | |
break; | |
case "{": | |
if (state === "selector" || state === "atRule") { | |
styleRule.selectorText = buffer.trim(); | |
styleRule.style.__starts = i; | |
buffer = ""; | |
state = "before-name"; | |
} else if (state === "atBlock") { | |
mediaRule.media.mediaText = buffer.trim(); | |
currentScope = parentRule = mediaRule; | |
mediaRule.parentStyleSheet = styleSheet; | |
buffer = ""; | |
state = "before-selector"; | |
} else if (state === "fontFaceRule-begin") { | |
if (parentRule) { | |
fontFaceRule.parentRule = parentRule; | |
} | |
fontFaceRule.parentStyleSheet = styleSheet; | |
styleRule = fontFaceRule; | |
buffer = ""; | |
state = "before-name"; | |
} else if (state === "keyframesRule-begin") { | |
keyframesRule.name = buffer.trim(); | |
if (parentRule) { | |
keyframesRule.parentRule = parentRule; | |
} | |
keyframesRule.parentStyleSheet = styleSheet; | |
currentScope = parentRule = keyframesRule; | |
buffer = ""; | |
state = "keyframeRule-begin"; | |
} else if (state === "keyframeRule-begin") { | |
styleRule = new CSSOM.CSSKeyframeRule; | |
styleRule.keyText = buffer.trim(); | |
styleRule.__starts = i; | |
buffer = ""; | |
state = "before-name"; | |
} else if (state === "documentRule-begin") { | |
// FIXME: what if this '{' is in the url text of the match function? | |
documentRule.matcher.matcherText = buffer.trim(); | |
if (parentRule) { | |
documentRule.parentRule = parentRule; | |
} | |
currentScope = parentRule = documentRule; | |
documentRule.parentStyleSheet = styleSheet; | |
buffer = ""; | |
state = "before-selector"; | |
} | |
break; | |
case ":": | |
if (state === "name") { | |
name = buffer.trim(); | |
buffer = ""; | |
state = "before-value"; | |
} else { | |
buffer += character; | |
} | |
break; | |
case '(': | |
if (state === 'value') { | |
// ie css expression mode | |
if (buffer.trim() == 'expression') { | |
var info = (new CSSOM.CSSValueExpression(token, i)).parse(); | |
if (info.error) { | |
parseError(info.error); | |
} else { | |
buffer += info.expression; | |
i = info.idx; | |
} | |
} else { | |
index = token.indexOf(')', i + 1); | |
if (index === -1) { | |
parseError('Unmatched "("'); | |
} | |
buffer += token.slice(i, index + 1); | |
i = index; | |
} | |
} else { | |
buffer += character; | |
} | |
break; | |
case "!": | |
if (state === "value" && token.indexOf("!important", i) === i) { | |
priority = "important"; | |
i += "important".length; | |
} else { | |
buffer += character; | |
} | |
break; | |
case ";": | |
switch (state) { | |
case "value": | |
styleRule.style.setProperty(name, buffer.trim(), priority); | |
priority = ""; | |
buffer = ""; | |
state = "before-name"; | |
break; | |
case "atRule": | |
buffer = ""; | |
state = "before-selector"; | |
break; | |
case "importRule": | |
importRule = new CSSOM.CSSImportRule; | |
importRule.parentStyleSheet = importRule.styleSheet.parentStyleSheet = styleSheet; | |
importRule.cssText = buffer + character; | |
styleSheet.cssRules.push(importRule); | |
buffer = ""; | |
state = "before-selector"; | |
break; | |
default: | |
buffer += character; | |
break; | |
} | |
break; | |
case "}": | |
switch (state) { | |
case "value": | |
styleRule.style.setProperty(name, buffer.trim(), priority); | |
priority = ""; | |
case "before-name": | |
case "name": | |
styleRule.__ends = i + 1; | |
if (parentRule) { | |
styleRule.parentRule = parentRule; | |
} | |
styleRule.parentStyleSheet = styleSheet; | |
currentScope.cssRules.push(styleRule); | |
buffer = ""; | |
if (currentScope.constructor === CSSOM.CSSKeyframesRule) { | |
state = "keyframeRule-begin"; | |
} else { | |
state = "before-selector"; | |
} | |
break; | |
case "keyframeRule-begin": | |
case "before-selector": | |
case "selector": | |
// End of media/document rule. | |
if (!parentRule) { | |
parseError("Unexpected }"); | |
} | |
currentScope.__ends = i + 1; | |
// Nesting rules aren't supported yet | |
styleSheet.cssRules.push(currentScope); | |
currentScope = styleSheet; | |
parentRule = null; | |
buffer = ""; | |
state = "before-selector"; | |
break; | |
} | |
break; | |
default: | |
switch (state) { | |
case "before-selector": | |
state = "selector"; | |
styleRule = new CSSOM.CSSStyleRule; | |
styleRule.__starts = i; | |
break; | |
case "before-name": | |
state = "name"; | |
break; | |
case "before-value": | |
state = "value"; | |
break; | |
case "importRule-begin": | |
state = "importRule"; | |
break; | |
} | |
buffer += character; | |
break; | |
} | |
} | |
return styleSheet; | |
}; | |
//.CommonJS | |
exports.parse = CSSOM.parse; | |
// The following modules cannot be included sooner due to the mutual dependency with parse.js | |
CSSOM.CSSStyleSheet = __webpack_require__(/*! ./CSSStyleSheet */ 54).CSSStyleSheet; | |
CSSOM.CSSStyleRule = __webpack_require__(/*! ./CSSStyleRule */ 48).CSSStyleRule; | |
CSSOM.CSSImportRule = __webpack_require__(/*! ./CSSImportRule */ 51).CSSImportRule; | |
CSSOM.CSSMediaRule = __webpack_require__(/*! ./CSSMediaRule */ 50).CSSMediaRule; | |
CSSOM.CSSFontFaceRule = __webpack_require__(/*! ./CSSFontFaceRule */ 52).CSSFontFaceRule; | |
CSSOM.CSSStyleDeclaration = __webpack_require__(/*! ./CSSStyleDeclaration */ 46).CSSStyleDeclaration; | |
CSSOM.CSSKeyframeRule = __webpack_require__(/*! ./CSSKeyframeRule */ 56).CSSKeyframeRule; | |
CSSOM.CSSKeyframesRule = __webpack_require__(/*! ./CSSKeyframesRule */ 55).CSSKeyframesRule; | |
CSSOM.CSSValueExpression = __webpack_require__(/*! ./CSSValueExpression */ 60).CSSValueExpression; | |
CSSOM.CSSDocumentRule = __webpack_require__(/*! ./CSSDocumentRule */ 58).CSSDocumentRule; | |
///CommonJS | |
/***/ }, | |
/* 62 */ | |
/*!**************************************!*\ | |
!*** ./~/jsdom/~/cssom/lib/clone.js ***! | |
\**************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//.CommonJS | |
var CSSOM = { | |
CSSStyleSheet: __webpack_require__(/*! ./CSSStyleSheet */ 54).CSSStyleSheet, | |
CSSStyleRule: __webpack_require__(/*! ./CSSStyleRule */ 48).CSSStyleRule, | |
CSSMediaRule: __webpack_require__(/*! ./CSSMediaRule */ 50).CSSMediaRule, | |
CSSStyleDeclaration: __webpack_require__(/*! ./CSSStyleDeclaration */ 46).CSSStyleDeclaration, | |
CSSKeyframeRule: __webpack_require__(/*! ./CSSKeyframeRule */ 56).CSSKeyframeRule, | |
CSSKeyframesRule: __webpack_require__(/*! ./CSSKeyframesRule */ 55).CSSKeyframesRule | |
}; | |
///CommonJS | |
/** | |
* Produces a deep copy of stylesheet — the instance variables of stylesheet are copied recursively. | |
* @param {CSSStyleSheet|CSSOM.CSSStyleSheet} stylesheet | |
* @nosideeffects | |
* @return {CSSOM.CSSStyleSheet} | |
*/ | |
CSSOM.clone = function clone(stylesheet) { | |
var cloned = new CSSOM.CSSStyleSheet; | |
var rules = stylesheet.cssRules; | |
if (!rules) { | |
return cloned; | |
} | |
var RULE_TYPES = { | |
1: CSSOM.CSSStyleRule, | |
4: CSSOM.CSSMediaRule, | |
//3: CSSOM.CSSImportRule, | |
//5: CSSOM.CSSFontFaceRule, | |
//6: CSSOM.CSSPageRule, | |
8: CSSOM.CSSKeyframesRule, | |
9: CSSOM.CSSKeyframeRule | |
}; | |
for (var i=0, rulesLength=rules.length; i < rulesLength; i++) { | |
var rule = rules[i]; | |
var ruleClone = cloned.cssRules[i] = new RULE_TYPES[rule.type]; | |
var style = rule.style; | |
if (style) { | |
var styleClone = ruleClone.style = new CSSOM.CSSStyleDeclaration; | |
for (var j=0, styleLength=style.length; j < styleLength; j++) { | |
var name = styleClone[j] = style[j]; | |
styleClone[name] = style[name]; | |
styleClone._importants[name] = style.getPropertyPriority(name); | |
} | |
styleClone.length = style.length; | |
} | |
if (rule.hasOwnProperty('keyText')) { | |
ruleClone.keyText = rule.keyText; | |
} | |
if (rule.hasOwnProperty('selectorText')) { | |
ruleClone.selectorText = rule.selectorText; | |
} | |
if (rule.hasOwnProperty('mediaText')) { | |
ruleClone.mediaText = rule.mediaText; | |
} | |
if (rule.hasOwnProperty('cssRules')) { | |
ruleClone.cssRules = clone(rule).cssRules; | |
} | |
} | |
return cloned; | |
}; | |
//.CommonJS | |
exports.clone = CSSOM.clone; | |
///CommonJS | |
/***/ }, | |
/* 63 */ | |
/*!**********************************************************!*\ | |
!*** ./~/jsdom/~/parse5/lib/tree_construction/parser.js ***! | |
\**********************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var Tokenizer = __webpack_require__(/*! ../tokenization/tokenizer */ 83), | |
OpenElementStack = __webpack_require__(/*! ./open_element_stack */ 79), | |
FormattingElementList = __webpack_require__(/*! ./formatting_element_list */ 80), | |
Doctype = __webpack_require__(/*! ./doctype */ 81), | |
DefaultTreeAdapter = __webpack_require__(/*! ../tree_adapters/default */ 66), | |
ForeignContent = __webpack_require__(/*! ../common/foreign_content */ 84), | |
UNICODE = __webpack_require__(/*! ../common/unicode */ 85), | |
HTML = __webpack_require__(/*! ../common/html */ 86); | |
//Aliases | |
var $ = HTML.TAG_NAMES, | |
NS = HTML.NAMESPACES, | |
ATTRS = HTML.ATTRS; | |
//Misc constants | |
var SEARCHABLE_INDEX_DEFAULT_PROMPT = 'This is a searchable index. Enter search keywords: ', | |
SEARCHABLE_INDEX_INPUT_NAME = 'isindex', | |
HIDDEN_INPUT_TYPE = 'hidden'; | |
//Insertion modes | |
var INITIAL_MODE = 'INITIAL_MODE', | |
BEFORE_HTML_MODE = 'BEFORE_HTML_MODE', | |
BEFORE_HEAD_MODE = 'BEFORE_HEAD_MODE', | |
IN_HEAD_MODE = 'IN_HEAD_MODE', | |
AFTER_HEAD_MODE = 'AFTER_HEAD_MODE', | |
IN_BODY_MODE = 'IN_BODY_MODE', | |
TEXT_MODE = 'TEXT_MODE', | |
IN_TABLE_MODE = 'IN_TABLE_MODE', | |
IN_TABLE_TEXT_MODE = 'IN_TABLE_TEXT_MODE', | |
IN_CAPTION_MODE = 'IN_CAPTION_MODE', | |
IN_COLUMN_GROUP_MODE = 'IN_COLUMN_GROUP_MODE', | |
IN_TABLE_BODY_MODE = 'IN_TABLE_BODY_MODE', | |
IN_ROW_MODE = 'IN_ROW_MODE', | |
IN_CELL_MODE = 'IN_CELL_MODE', | |
IN_SELECT_MODE = 'IN_SELECT_MODE', | |
IN_SELECT_IN_TABLE_MODE = 'IN_SELECT_IN_TABLE_MODE', | |
AFTER_BODY_MODE = 'AFTER_BODY_MODE', | |
IN_FRAMESET_MODE = 'IN_FRAMESET_MODE', | |
AFTER_FRAMESET_MODE = 'AFTER_FRAMESET_MODE', | |
AFTER_AFTER_BODY_MODE = 'AFTER_AFTER_BODY_MODE', | |
AFTER_AFTER_FRAMESET_MODE = 'AFTER_AFTER_FRAMESET_MODE'; | |
//Insertion mode reset map | |
var INSERTION_MODE_RESET_MAP = {}; | |
INSERTION_MODE_RESET_MAP[$.SELECT] = IN_SELECT_MODE; | |
INSERTION_MODE_RESET_MAP[$.TR] = IN_ROW_MODE; | |
INSERTION_MODE_RESET_MAP[$.TBODY] = | |
INSERTION_MODE_RESET_MAP[$.THEAD] = | |
INSERTION_MODE_RESET_MAP[$.TFOOT] = IN_TABLE_BODY_MODE; | |
INSERTION_MODE_RESET_MAP[$.CAPTION] = IN_CAPTION_MODE; | |
INSERTION_MODE_RESET_MAP[$.COLGROUP] = IN_COLUMN_GROUP_MODE; | |
INSERTION_MODE_RESET_MAP[$.TABLE] = IN_TABLE_MODE; | |
INSERTION_MODE_RESET_MAP[$.HEAD] = | |
INSERTION_MODE_RESET_MAP[$.BODY] = IN_BODY_MODE; | |
INSERTION_MODE_RESET_MAP[$.FRAMESET] = IN_FRAMESET_MODE; | |
INSERTION_MODE_RESET_MAP[$.HTML] = BEFORE_HEAD_MODE; | |
//Token handlers map for insertion modes | |
var _ = {}; | |
_[INITIAL_MODE] = {}; | |
_[INITIAL_MODE][Tokenizer.CHARACTER_TOKEN] = | |
_[INITIAL_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = tokenInInitialMode; | |
_[INITIAL_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = ignoreToken; | |
_[INITIAL_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; | |
_[INITIAL_MODE][Tokenizer.DOCTYPE_TOKEN] = doctypeInInitialMode; | |
_[INITIAL_MODE][Tokenizer.START_TAG_TOKEN] = | |
_[INITIAL_MODE][Tokenizer.END_TAG_TOKEN] = | |
_[INITIAL_MODE][Tokenizer.EOF_TOKEN] = tokenInInitialMode; | |
_[BEFORE_HTML_MODE] = {}; | |
_[BEFORE_HTML_MODE][Tokenizer.CHARACTER_TOKEN] = | |
_[BEFORE_HTML_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = tokenBeforeHtml; | |
_[BEFORE_HTML_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = ignoreToken; | |
_[BEFORE_HTML_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; | |
_[BEFORE_HTML_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; | |
_[BEFORE_HTML_MODE][Tokenizer.START_TAG_TOKEN] = startTagBeforeHtml; | |
_[BEFORE_HTML_MODE][Tokenizer.END_TAG_TOKEN] = endTagBeforeHtml; | |
_[BEFORE_HTML_MODE][Tokenizer.EOF_TOKEN] = tokenBeforeHtml; | |
_[BEFORE_HEAD_MODE] = {}; | |
_[BEFORE_HEAD_MODE][Tokenizer.CHARACTER_TOKEN] = | |
_[BEFORE_HEAD_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = tokenBeforeHead; | |
_[BEFORE_HEAD_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = ignoreToken; | |
_[BEFORE_HEAD_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; | |
_[BEFORE_HEAD_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; | |
_[BEFORE_HEAD_MODE][Tokenizer.START_TAG_TOKEN] = startTagBeforeHead; | |
_[BEFORE_HEAD_MODE][Tokenizer.END_TAG_TOKEN] = endTagBeforeHead; | |
_[BEFORE_HEAD_MODE][Tokenizer.EOF_TOKEN] = tokenBeforeHead; | |
_[IN_HEAD_MODE] = {}; | |
_[IN_HEAD_MODE][Tokenizer.CHARACTER_TOKEN] = | |
_[IN_HEAD_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = tokenInHead; | |
_[IN_HEAD_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = insertCharacters; | |
_[IN_HEAD_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; | |
_[IN_HEAD_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; | |
_[IN_HEAD_MODE][Tokenizer.START_TAG_TOKEN] = startTagInHead; | |
_[IN_HEAD_MODE][Tokenizer.END_TAG_TOKEN] = endTagInHead; | |
_[IN_HEAD_MODE][Tokenizer.EOF_TOKEN] = tokenInHead; | |
_[AFTER_HEAD_MODE] = {}; | |
_[AFTER_HEAD_MODE][Tokenizer.CHARACTER_TOKEN] = | |
_[AFTER_HEAD_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = tokenAfterHead; | |
_[AFTER_HEAD_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = insertCharacters; | |
_[AFTER_HEAD_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; | |
_[AFTER_HEAD_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; | |
_[AFTER_HEAD_MODE][Tokenizer.START_TAG_TOKEN] = startTagAfterHead; | |
_[AFTER_HEAD_MODE][Tokenizer.END_TAG_TOKEN] = endTagAfterHead; | |
_[AFTER_HEAD_MODE][Tokenizer.EOF_TOKEN] = tokenAfterHead; | |
_[IN_BODY_MODE] = {}; | |
_[IN_BODY_MODE][Tokenizer.CHARACTER_TOKEN] = characterInBody; | |
_[IN_BODY_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; | |
_[IN_BODY_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = whitespaceCharacterInBody; | |
_[IN_BODY_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; | |
_[IN_BODY_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; | |
_[IN_BODY_MODE][Tokenizer.START_TAG_TOKEN] = startTagInBody; | |
_[IN_BODY_MODE][Tokenizer.END_TAG_TOKEN] = endTagInBody; | |
_[IN_BODY_MODE][Tokenizer.EOF_TOKEN] = stopParsing; | |
_[TEXT_MODE] = {}; | |
_[TEXT_MODE][Tokenizer.CHARACTER_TOKEN] = | |
_[TEXT_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = | |
_[TEXT_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = insertCharacters; | |
_[TEXT_MODE][Tokenizer.COMMENT_TOKEN] = | |
_[TEXT_MODE][Tokenizer.DOCTYPE_TOKEN] = | |
_[TEXT_MODE][Tokenizer.START_TAG_TOKEN] = ignoreToken; | |
_[TEXT_MODE][Tokenizer.END_TAG_TOKEN] = endTagInText; | |
_[TEXT_MODE][Tokenizer.EOF_TOKEN] = eofInText; | |
_[IN_TABLE_MODE] = {}; | |
_[IN_TABLE_MODE][Tokenizer.CHARACTER_TOKEN] = | |
_[IN_TABLE_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = | |
_[IN_TABLE_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = characterInTable; | |
_[IN_TABLE_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; | |
_[IN_TABLE_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; | |
_[IN_TABLE_MODE][Tokenizer.START_TAG_TOKEN] = startTagInTable; | |
_[IN_TABLE_MODE][Tokenizer.END_TAG_TOKEN] = endTagInTable; | |
_[IN_TABLE_MODE][Tokenizer.EOF_TOKEN] = stopParsing; | |
_[IN_TABLE_TEXT_MODE] = {}; | |
_[IN_TABLE_TEXT_MODE][Tokenizer.CHARACTER_TOKEN] = characterInTableText; | |
_[IN_TABLE_TEXT_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; | |
_[IN_TABLE_TEXT_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = whitespaceCharacterInTableText; | |
_[IN_TABLE_TEXT_MODE][Tokenizer.COMMENT_TOKEN] = | |
_[IN_TABLE_TEXT_MODE][Tokenizer.DOCTYPE_TOKEN] = | |
_[IN_TABLE_TEXT_MODE][Tokenizer.START_TAG_TOKEN] = | |
_[IN_TABLE_TEXT_MODE][Tokenizer.END_TAG_TOKEN] = | |
_[IN_TABLE_TEXT_MODE][Tokenizer.EOF_TOKEN] = tokenInTableText; | |
_[IN_CAPTION_MODE] = {}; | |
_[IN_CAPTION_MODE][Tokenizer.CHARACTER_TOKEN] = characterInBody; | |
_[IN_CAPTION_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; | |
_[IN_CAPTION_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = whitespaceCharacterInBody; | |
_[IN_CAPTION_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; | |
_[IN_CAPTION_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; | |
_[IN_CAPTION_MODE][Tokenizer.START_TAG_TOKEN] = startTagInCaption; | |
_[IN_CAPTION_MODE][Tokenizer.END_TAG_TOKEN] = endTagInCaption; | |
_[IN_CAPTION_MODE][Tokenizer.EOF_TOKEN] = stopParsing; | |
_[IN_COLUMN_GROUP_MODE] = {}; | |
_[IN_COLUMN_GROUP_MODE][Tokenizer.CHARACTER_TOKEN] = | |
_[IN_COLUMN_GROUP_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = tokenInColumnGroup; | |
_[IN_COLUMN_GROUP_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = insertCharacters; | |
_[IN_COLUMN_GROUP_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; | |
_[IN_COLUMN_GROUP_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; | |
_[IN_COLUMN_GROUP_MODE][Tokenizer.START_TAG_TOKEN] = startTagInColumnGroup; | |
_[IN_COLUMN_GROUP_MODE][Tokenizer.END_TAG_TOKEN] = endTagInColumnGroup; | |
_[IN_COLUMN_GROUP_MODE][Tokenizer.EOF_TOKEN] = stopParsing; | |
_[IN_TABLE_BODY_MODE] = {}; | |
_[IN_TABLE_BODY_MODE][Tokenizer.CHARACTER_TOKEN] = | |
_[IN_TABLE_BODY_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = | |
_[IN_TABLE_BODY_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = characterInTable; | |
_[IN_TABLE_BODY_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; | |
_[IN_TABLE_BODY_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; | |
_[IN_TABLE_BODY_MODE][Tokenizer.START_TAG_TOKEN] = startTagInTableBody; | |
_[IN_TABLE_BODY_MODE][Tokenizer.END_TAG_TOKEN] = endTagInTableBody; | |
_[IN_TABLE_BODY_MODE][Tokenizer.EOF_TOKEN] = stopParsing; | |
_[IN_ROW_MODE] = {}; | |
_[IN_ROW_MODE][Tokenizer.CHARACTER_TOKEN] = | |
_[IN_ROW_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = | |
_[IN_ROW_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = characterInTable; | |
_[IN_ROW_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; | |
_[IN_ROW_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; | |
_[IN_ROW_MODE][Tokenizer.START_TAG_TOKEN] = startTagInRow; | |
_[IN_ROW_MODE][Tokenizer.END_TAG_TOKEN] = endTagInRow; | |
_[IN_ROW_MODE][Tokenizer.EOF_TOKEN] = stopParsing; | |
_[IN_CELL_MODE] = {}; | |
_[IN_CELL_MODE][Tokenizer.CHARACTER_TOKEN] = characterInBody; | |
_[IN_CELL_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; | |
_[IN_CELL_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = whitespaceCharacterInBody; | |
_[IN_CELL_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; | |
_[IN_CELL_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; | |
_[IN_CELL_MODE][Tokenizer.START_TAG_TOKEN] = startTagInCell; | |
_[IN_CELL_MODE][Tokenizer.END_TAG_TOKEN] = endTagInCell; | |
_[IN_CELL_MODE][Tokenizer.EOF_TOKEN] = stopParsing; | |
_[IN_SELECT_MODE] = {}; | |
_[IN_SELECT_MODE][Tokenizer.CHARACTER_TOKEN] = insertCharacters; | |
_[IN_SELECT_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; | |
_[IN_SELECT_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = insertCharacters; | |
_[IN_SELECT_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; | |
_[IN_SELECT_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; | |
_[IN_SELECT_MODE][Tokenizer.START_TAG_TOKEN] = startTagInSelect; | |
_[IN_SELECT_MODE][Tokenizer.END_TAG_TOKEN] = endTagInSelect; | |
_[IN_SELECT_MODE][Tokenizer.EOF_TOKEN] = stopParsing; | |
_[IN_SELECT_IN_TABLE_MODE] = {}; | |
_[IN_SELECT_IN_TABLE_MODE][Tokenizer.CHARACTER_TOKEN] = insertCharacters; | |
_[IN_SELECT_IN_TABLE_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; | |
_[IN_SELECT_IN_TABLE_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = insertCharacters; | |
_[IN_SELECT_IN_TABLE_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; | |
_[IN_SELECT_IN_TABLE_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; | |
_[IN_SELECT_IN_TABLE_MODE][Tokenizer.START_TAG_TOKEN] = startTagInSelectInTable; | |
_[IN_SELECT_IN_TABLE_MODE][Tokenizer.END_TAG_TOKEN] = endTagInSelectInTable; | |
_[IN_SELECT_IN_TABLE_MODE][Tokenizer.EOF_TOKEN] = stopParsing; | |
_[AFTER_BODY_MODE] = {}; | |
_[AFTER_BODY_MODE][Tokenizer.CHARACTER_TOKEN] = | |
_[AFTER_BODY_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = tokenAfterBody; | |
_[AFTER_BODY_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = whitespaceCharacterInBody; | |
_[AFTER_BODY_MODE][Tokenizer.COMMENT_TOKEN] = appendCommentToRootHtmlElement; | |
_[AFTER_BODY_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; | |
_[AFTER_BODY_MODE][Tokenizer.START_TAG_TOKEN] = startTagAfterBody; | |
_[AFTER_BODY_MODE][Tokenizer.END_TAG_TOKEN] = endTagAfterBody; | |
_[AFTER_BODY_MODE][Tokenizer.EOF_TOKEN] = stopParsing; | |
_[IN_FRAMESET_MODE] = {}; | |
_[IN_FRAMESET_MODE][Tokenizer.CHARACTER_TOKEN] = | |
_[IN_FRAMESET_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; | |
_[IN_FRAMESET_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = insertCharacters; | |
_[IN_FRAMESET_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; | |
_[IN_FRAMESET_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; | |
_[IN_FRAMESET_MODE][Tokenizer.START_TAG_TOKEN] = startTagInFrameset; | |
_[IN_FRAMESET_MODE][Tokenizer.END_TAG_TOKEN] = endTagInFrameset; | |
_[IN_FRAMESET_MODE][Tokenizer.EOF_TOKEN] = stopParsing; | |
_[AFTER_FRAMESET_MODE] = {}; | |
_[AFTER_FRAMESET_MODE][Tokenizer.CHARACTER_TOKEN] = | |
_[AFTER_FRAMESET_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; | |
_[AFTER_FRAMESET_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = insertCharacters; | |
_[AFTER_FRAMESET_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; | |
_[AFTER_FRAMESET_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; | |
_[AFTER_FRAMESET_MODE][Tokenizer.START_TAG_TOKEN] = startTagAfterFrameset; | |
_[AFTER_FRAMESET_MODE][Tokenizer.END_TAG_TOKEN] = endTagAfterFrameset; | |
_[AFTER_FRAMESET_MODE][Tokenizer.EOF_TOKEN] = stopParsing; | |
_[AFTER_AFTER_BODY_MODE] = {}; | |
_[AFTER_AFTER_BODY_MODE][Tokenizer.CHARACTER_TOKEN] = tokenAfterAfterBody; | |
_[AFTER_AFTER_BODY_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = tokenAfterAfterBody; | |
_[AFTER_AFTER_BODY_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = whitespaceCharacterInBody; | |
_[AFTER_AFTER_BODY_MODE][Tokenizer.COMMENT_TOKEN] = appendCommentToDocument; | |
_[AFTER_AFTER_BODY_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; | |
_[AFTER_AFTER_BODY_MODE][Tokenizer.START_TAG_TOKEN] = startTagAfterAfterBody; | |
_[AFTER_AFTER_BODY_MODE][Tokenizer.END_TAG_TOKEN] = tokenAfterAfterBody; | |
_[AFTER_AFTER_BODY_MODE][Tokenizer.EOF_TOKEN] = stopParsing; | |
_[AFTER_AFTER_FRAMESET_MODE] = {}; | |
_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.CHARACTER_TOKEN] = | |
_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; | |
_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = whitespaceCharacterInBody; | |
_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.COMMENT_TOKEN] = appendCommentToDocument; | |
_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; | |
_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.START_TAG_TOKEN] = startTagAfterAfterFrameset; | |
_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.END_TAG_TOKEN] = ignoreToken; | |
_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.EOF_TOKEN] = stopParsing; | |
//Searchable index building utils (<isindex> tag) | |
function getSearchableIndexFormAttrs(isindexStartTagToken) { | |
var indexAction = Tokenizer.getTokenAttr(isindexStartTagToken, ATTRS.ACTION), | |
attrs = []; | |
if (indexAction !== null) { | |
attrs.push({ | |
name: ATTRS.ACTION, | |
value: indexAction | |
}); | |
} | |
return attrs; | |
} | |
function getSearchableIndexLabelText(isindexStartTagToken) { | |
var indexPrompt = Tokenizer.getTokenAttr(isindexStartTagToken, ATTRS.PROMPT); | |
return indexPrompt === null ? SEARCHABLE_INDEX_DEFAULT_PROMPT : indexPrompt; | |
} | |
function getSearchableIndexInputAttrs(isindexStartTagToken) { | |
var isindexAttrs = isindexStartTagToken.attrs, | |
inputAttrs = []; | |
for (var i = 0; i < isindexAttrs.length; i++) { | |
var name = isindexAttrs[i].name; | |
if (name !== ATTRS.NAME && name !== ATTRS.ACTION && name !== ATTRS.PROMPT) | |
inputAttrs.push(isindexAttrs[i]); | |
} | |
inputAttrs.push({ | |
name: ATTRS.NAME, | |
value: SEARCHABLE_INDEX_INPUT_NAME | |
}); | |
return inputAttrs; | |
} | |
//Parser | |
var Parser = module.exports = function (treeAdapter) { | |
this.treeAdapter = treeAdapter || DefaultTreeAdapter; | |
}; | |
//API | |
Parser.prototype.parse = function (html) { | |
var document = this.treeAdapter.createDocument(); | |
this._reset(html, document, null); | |
this._runParsingLoop(); | |
return document; | |
}; | |
Parser.prototype.parseFragment = function (html, fragmentContext) { | |
//NOTE: use <div> element as a fragment context if context element was not provided | |
if (!fragmentContext) | |
fragmentContext = this.treeAdapter.createElement($.DIV, NS.HTML, []); | |
//NOTE: create fake element which will be used as 'document' for fragment parsing. | |
//This is important for jsdom there 'document' can't be recreated, therefore | |
//fragment parsing causes messing of the main `document`. | |
var documentMock = this.treeAdapter.createElement('documentmock', NS.HTML, []); | |
this._reset(html, documentMock, fragmentContext); | |
this._initTokenizerForFragmentParsing(); | |
this._insertFakeRootElement(); | |
this._resetInsertionModeAppropriately(); | |
this._findFormInFragmentContext(); | |
this._runParsingLoop(); | |
var rootElement = this.treeAdapter.getFirstChild(documentMock), | |
fragment = this.treeAdapter.createDocumentFragment(); | |
this._adoptNodes(rootElement, fragment); | |
return fragment; | |
}; | |
//Reset state | |
Parser.prototype._reset = function (html, document, fragmentContext) { | |
this.tokenizer = new Tokenizer(html); | |
this.stopped = false; | |
this.insertionMode = INITIAL_MODE; | |
this.originalInsertionMode = ''; | |
this.document = document; | |
this.fragmentContext = fragmentContext; | |
this.headElement = null; | |
this.formElement = null; | |
this.openElements = new OpenElementStack(this.document, this.treeAdapter); | |
this.activeFormattingElements = new FormattingElementList(this.treeAdapter); | |
this.pendingCharacterTokens = []; | |
this.hasNonWhitespacePendingCharacterToken = false; | |
this.framesetOk = true; | |
this.skipNextNewLine = false; | |
this.fosterParentingEnabled = false; | |
}; | |
//Parsing loop | |
Parser.prototype._runParsingLoop = function () { | |
while (!this.stopped) { | |
this._setupTokenizerCDATAMode(); | |
var token = this.tokenizer.getNextToken(); | |
if (this.skipNextNewLine) { | |
this.skipNextNewLine = false; | |
if (token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN && token.chars[0] === '\n') { | |
if (token.chars.length === 1) | |
continue; | |
token.chars = token.chars.substr(1); | |
} | |
} | |
if (this._shouldProcessTokenInForeignContent(token)) | |
this._processTokenInForeignContent(token); | |
else | |
this._processToken(token); | |
} | |
}; | |
//Text parsing | |
Parser.prototype._setupTokenizerCDATAMode = function () { | |
var current = this._getAdjustedCurrentElement(); | |
this.tokenizer.allowCDATA = current && current !== this.document && | |
this.treeAdapter.getNamespaceURI(current) !== NS.HTML && | |
(!this._isHtmlIntegrationPoint(current)) && | |
(!this._isMathMLTextIntegrationPoint(current)); | |
}; | |
Parser.prototype._switchToTextParsing = function (currentToken, nextTokenizerState) { | |
this._insertElement(currentToken, NS.HTML); | |
this.tokenizer.state = nextTokenizerState; | |
this.originalInsertionMode = this.insertionMode; | |
this.insertionMode = TEXT_MODE; | |
}; | |
//Fragment parsing | |
Parser.prototype._getAdjustedCurrentElement = function () { | |
return this.openElements.stackTop === 0 && this.fragmentContext ? this.fragmentContext : this.openElements.current; | |
}; | |
Parser.prototype._findFormInFragmentContext = function () { | |
var node = this.fragmentContext; | |
do { | |
if (this.treeAdapter.getTagName(node) === $.FORM) { | |
this.formElement = node; | |
break; | |
} | |
node = this.treeAdapter.getParentNode(node); | |
} while (node); | |
}; | |
Parser.prototype._initTokenizerForFragmentParsing = function () { | |
var tn = this.treeAdapter.getTagName(this.fragmentContext); | |
if (tn === $.TITLE || tn === $.TEXTAREA) | |
this.tokenizer.state = Tokenizer.RCDATA_STATE; | |
else if (tn === $.STYLE || tn === $.XMP || tn === $.IFRAME || | |
tn === $.NOEMBED || tn === $.NOFRAMES || tn === $.NOSCRIPT) { | |
this.tokenizer.state = Tokenizer.RAWTEXT_STATE; | |
} | |
else if (tn === $.SCRIPT) | |
this.tokenizer.state = Tokenizer.SCRIPT_DATA_STATE; | |
else if (tn === $.PLAINTEXT) | |
this.tokenizer.state = Tokenizer.PLAINTEXT_STATE; | |
}; | |
//Tree mutation | |
Parser.prototype._setDocumentType = function (token) { | |
this.treeAdapter.setDocumentType(this.document, token.name, token.publicId, token.systemId); | |
}; | |
Parser.prototype._attachElementToTree = function (element) { | |
if (this.fosterParentingEnabled && this._isElementCausesFosterParenting(this.openElements.current)) | |
this._fosterParentElement(element); | |
else | |
this.treeAdapter.appendChild(this.openElements.current, element); | |
}; | |
Parser.prototype._appendElement = function (token, namespaceURI) { | |
var element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs); | |
this._attachElementToTree(element); | |
}; | |
Parser.prototype._insertElement = function (token, namespaceURI) { | |
var element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs); | |
this._attachElementToTree(element); | |
this.openElements.push(element); | |
}; | |
Parser.prototype._insertFakeRootElement = function () { | |
var element = this.treeAdapter.createElement($.HTML, NS.HTML, []); | |
this.treeAdapter.appendChild(this.openElements.current, element); | |
this.openElements.push(element); | |
}; | |
Parser.prototype._appendCommentNode = function (token, parent) { | |
var commentNode = this.treeAdapter.createCommentNode(token.data); | |
this.treeAdapter.appendChild(parent, commentNode); | |
}; | |
Parser.prototype._insertCharacters = function (token) { | |
if (this.fosterParentingEnabled && this._isElementCausesFosterParenting(this.openElements.current)) { | |
var location = this._findFosterParentingLocation(); | |
if (location.beforeElement) | |
this.treeAdapter.insertTextBefore(location.parent, token.chars, location.beforeElement); | |
else | |
this.treeAdapter.insertText(location.parent, token.chars); | |
} | |
else | |
this.treeAdapter.insertText(this.openElements.current, token.chars); | |
}; | |
Parser.prototype._adoptNodes = function (donor, recipient) { | |
while (true) { | |
var child = this.treeAdapter.getFirstChild(donor); | |
if (!child) | |
break; | |
this.treeAdapter.detachNode(child); | |
this.treeAdapter.appendChild(recipient, child); | |
} | |
}; | |
//Token processing | |
Parser.prototype._shouldProcessTokenInForeignContent = function (token) { | |
var current = this._getAdjustedCurrentElement(); | |
if (!current || current === this.document) | |
return false; | |
var ns = this.treeAdapter.getNamespaceURI(current); | |
if (ns === NS.HTML) | |
return false; | |
if (this.treeAdapter.getTagName(current) === $.ANNOTATION_XML && ns === NS.MATHML && | |
token.type === Tokenizer.START_TAG_TOKEN && token.tagName === $.SVG) { | |
return false; | |
} | |
var isCharacterToken = token.type === Tokenizer.CHARACTER_TOKEN || | |
token.type === Tokenizer.NULL_CHARACTER_TOKEN || | |
token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN, | |
isMathMLTextStartTag = token.type === Tokenizer.START_TAG_TOKEN && | |
token.tagName !== $.MGLYPH && | |
token.tagName !== $.MALIGNMARK; | |
if ((isMathMLTextStartTag || isCharacterToken) && this._isMathMLTextIntegrationPoint(current)) | |
return false; | |
if ((token.type === Tokenizer.START_TAG_TOKEN || isCharacterToken) && this._isHtmlIntegrationPoint(current)) | |
return false; | |
return token.type !== Tokenizer.EOF_TOKEN; | |
}; | |
Parser.prototype._processToken = function (token) { | |
_[this.insertionMode][token.type](this, token); | |
}; | |
Parser.prototype._processTokenInBodyMode = function (token) { | |
_[IN_BODY_MODE][token.type](this, token); | |
}; | |
Parser.prototype._processTokenInForeignContent = function (token) { | |
if (token.type === Tokenizer.CHARACTER_TOKEN) | |
characterInForeignContent(this, token); | |
else if (token.type === Tokenizer.NULL_CHARACTER_TOKEN) | |
nullCharacterInForeignContent(this, token); | |
else if (token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN) | |
insertCharacters(this, token); | |
else if (token.type === Tokenizer.COMMENT_TOKEN) | |
appendComment(this, token); | |
else if (token.type === Tokenizer.START_TAG_TOKEN) | |
startTagInForeignContent(this, token); | |
else if (token.type === Tokenizer.END_TAG_TOKEN) | |
endTagInForeignContent(this, token); | |
}; | |
Parser.prototype._processFakeStartTagWithAttrs = function (tagName, attrs) { | |
var fakeToken = this.tokenizer.buildStartTagToken(tagName); | |
fakeToken.attrs = attrs; | |
this._processToken(fakeToken); | |
}; | |
Parser.prototype._processFakeStartTag = function (tagName) { | |
var fakeToken = this.tokenizer.buildStartTagToken(tagName); | |
this._processToken(fakeToken); | |
return fakeToken; | |
}; | |
Parser.prototype._processFakeEndTag = function (tagName) { | |
var fakeToken = this.tokenizer.buildEndTagToken(tagName); | |
this._processToken(fakeToken); | |
return fakeToken; | |
}; | |
//Integration points | |
Parser.prototype._isMathMLTextIntegrationPoint = function (element) { | |
var tn = this.treeAdapter.getTagName(element), | |
ns = this.treeAdapter.getNamespaceURI(element); | |
return ForeignContent.isMathMLTextIntegrationPoint(tn, ns); | |
}; | |
Parser.prototype._isHtmlIntegrationPoint = function (element) { | |
var tn = this.treeAdapter.getTagName(element), | |
ns = this.treeAdapter.getNamespaceURI(element), | |
attrs = this.treeAdapter.getAttrList(element); | |
return ForeignContent.isHtmlIntegrationPoint(tn, ns, attrs); | |
}; | |
//Active formatting elements reconstruction | |
Parser.prototype._reconstructActiveFormattingElements = function () { | |
var listLength = this.activeFormattingElements.length; | |
if (listLength) { | |
var unopenIdx = listLength, | |
entry = null; | |
do { | |
unopenIdx--; | |
entry = this.activeFormattingElements.entries[unopenIdx]; | |
if (entry.type === FormattingElementList.MARKER_ENTRY || this.openElements.contains(entry.element)) { | |
unopenIdx++; | |
break; | |
} | |
} while (unopenIdx > 0); | |
for (var i = unopenIdx; i < listLength; i++) { | |
entry = this.activeFormattingElements.entries[i]; | |
this._insertElement(entry.token, this.treeAdapter.getNamespaceURI(entry.element)); | |
entry.element = this.openElements.current; | |
} | |
} | |
}; | |
//Close elements | |
Parser.prototype._closeTableCell = function () { | |
if (this.openElements.hasInTableScope($.TD)) | |
this._processFakeEndTag($.TD); | |
else | |
this._processFakeEndTag($.TH); | |
}; | |
Parser.prototype._closePElement = function () { | |
this.openElements.generateImpliedEndTagsWithExclusion($.P); | |
this.openElements.popUntilTagNamePopped($.P); | |
}; | |
//Insertion mode | |
Parser.prototype._resetInsertionModeAppropriately = function () { | |
for (var i = this.openElements.stackTop, last = false; i >= 0; i--) { | |
var element = this.openElements.items[i]; | |
if (this.openElements.items[0] === element) { | |
last = true; | |
element = this.fragmentContext; | |
} | |
var tn = this.treeAdapter.getTagName(element), | |
resetInsertionMode = INSERTION_MODE_RESET_MAP[tn]; | |
if (resetInsertionMode) { | |
this.insertionMode = resetInsertionMode; | |
break; | |
} | |
else if (!last && (tn === $.TD || tn === $.TH)) { | |
this.insertionMode = IN_CELL_MODE; | |
break; | |
} | |
else if (last) { | |
this.insertionMode = IN_BODY_MODE; | |
break; | |
} | |
} | |
}; | |
//Adoption agency alogrithm | |
//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#adoptionAgency) | |
Parser.prototype._obtainFormattingElementEntryForAdoptionAgency = function (token) { | |
//NOTE: step 4 of the algorithm | |
var tn = token.tagName, | |
formattingElementEntry = this.activeFormattingElements.getElementEntryInScopeWithTagName(tn); | |
if (formattingElementEntry) { | |
if (!this.openElements.contains(formattingElementEntry.element)) { | |
this.activeFormattingElements.removeEntry(formattingElementEntry); | |
formattingElementEntry = null; | |
} | |
else if (!this.openElements.hasInScope(tn)) | |
formattingElementEntry = null; | |
} | |
else | |
genericEndTagInBody(this, token); | |
return formattingElementEntry; | |
}; | |
Parser.prototype._obtainFurthestBlockForAdoptionAgency = function (formattingElementEntry) { | |
//NOTE: steps 5 and 6 of the algorithm | |
var furthestBlock = null; | |
for (var i = this.openElements.stackTop; i >= 0; i--) { | |
var element = this.openElements.items[i]; | |
if (element === formattingElementEntry.element) | |
break; | |
if (this._isSpecialElement(element)) | |
furthestBlock = element; | |
} | |
if (!furthestBlock) { | |
this.openElements.popUntilElementPopped(formattingElementEntry.element); | |
this.activeFormattingElements.removeEntry(formattingElementEntry); | |
} | |
return furthestBlock; | |
}; | |
Parser.prototype._recreateElementForAdoptionAgency = function (elementEntry) { | |
//NOTE: step 9.7 of the algorithm | |
var ns = this.treeAdapter.getNamespaceURI(elementEntry.element), | |
newElement = this.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs); | |
this.openElements.replace(elementEntry.element, newElement); | |
elementEntry.element = newElement; | |
return newElement; | |
}; | |
Parser.prototype._adoptionAgencyInnerLoop = function (furthestBlock, formattingElement) { | |
var element = null, | |
lastElement = furthestBlock, | |
nextElement = this.openElements.getCommonAncestor(furthestBlock); | |
for (var i = 0; i < 3; i++) { | |
element = nextElement; | |
//NOTE: store next element for the next loop iteration (it may be deleted from the stack by step 9.5) | |
nextElement = this.openElements.getCommonAncestor(element); | |
var elementEntry = this.activeFormattingElements.getElementEntry(element); | |
if (!elementEntry) { | |
this.openElements.remove(element); | |
continue; | |
} | |
if (element === formattingElement) | |
break; | |
element = this._recreateElementForAdoptionAgency(elementEntry); | |
if (lastElement === furthestBlock) | |
this.activeFormattingElements.bookmark = elementEntry; | |
this.treeAdapter.detachNode(lastElement); | |
this.treeAdapter.appendChild(element, lastElement); | |
lastElement = element; | |
} | |
return lastElement; | |
}; | |
Parser.prototype._replaceFormattingElementForAdoptionAgency = function (furthestBlock, formattingElementEntry) { | |
//NOTE: steps 11-15 of the algorithm | |
var ns = this.treeAdapter.getNamespaceURI(formattingElementEntry.element), | |
token = formattingElementEntry.token, | |
newElement = this.treeAdapter.createElement(token.tagName, ns, token.attrs); | |
this._adoptNodes(furthestBlock, newElement); | |
this.treeAdapter.appendChild(furthestBlock, newElement); | |
this.activeFormattingElements.insertElementAfterBookmark(newElement, formattingElementEntry.token); | |
this.activeFormattingElements.removeEntry(formattingElementEntry); | |
this.openElements.remove(formattingElementEntry.element); | |
this.openElements.insertAfter(furthestBlock, newElement); | |
}; | |
Parser.prototype._callAdoptionAgency = function (token) { | |
for (var i = 0; i < 8; i++) { | |
var formattingElementEntry = this._obtainFormattingElementEntryForAdoptionAgency(token); | |
if (!formattingElementEntry) | |
break; | |
var furthestBlock = this._obtainFurthestBlockForAdoptionAgency(formattingElementEntry); | |
if (!furthestBlock) | |
break; | |
this.activeFormattingElements.bookmark = formattingElementEntry; | |
var lastElement = this._adoptionAgencyInnerLoop(furthestBlock, formattingElementEntry.element), | |
commonAncestor = this.openElements.getCommonAncestor(formattingElementEntry.element); | |
this.treeAdapter.detachNode(lastElement); | |
if (this._isElementCausesFosterParenting(commonAncestor)) | |
this._fosterParentElement(lastElement); | |
else | |
this.treeAdapter.appendChild(commonAncestor, lastElement); | |
this._replaceFormattingElementForAdoptionAgency(furthestBlock, formattingElementEntry); | |
} | |
}; | |
//Foster parenting | |
Parser.prototype._isElementCausesFosterParenting = function (element) { | |
var tn = this.treeAdapter.getTagName(element); | |
return tn === $.TABLE || tn === $.TBODY || tn === $.TFOOT || tn == $.THEAD || tn === $.TR; | |
}; | |
Parser.prototype._findFosterParentingLocation = function () { | |
var location = { | |
parent: null, | |
beforeElement: null | |
}; | |
for (var i = this.openElements.stackTop; i >= 0; i--) { | |
var openElement = this.openElements.items[i]; | |
if (this.treeAdapter.getTagName(openElement) === $.TABLE) { | |
location.parent = this.treeAdapter.getParentNode(openElement); | |
if (location.parent) | |
location.beforeElement = openElement; | |
else | |
location.parent = this.openElements.items[i - 1]; | |
break; | |
} | |
} | |
if (!location.parent) | |
location.parent = this.openElements.items[0]; | |
return location; | |
}; | |
Parser.prototype._fosterParentElement = function (element) { | |
var location = this._findFosterParentingLocation(); | |
if (location.beforeElement) | |
this.treeAdapter.insertBefore(location.parent, element, location.beforeElement); | |
else | |
this.treeAdapter.appendChild(location.parent, element); | |
}; | |
//Special elements | |
Parser.prototype._isSpecialElement = function (element) { | |
var tn = this.treeAdapter.getTagName(element), | |
ns = this.treeAdapter.getNamespaceURI(element); | |
return HTML.SPECIAL_ELEMENTS[ns][tn]; | |
}; | |
//Generic token handlers | |
//------------------------------------------------------------------ | |
function ignoreToken(p, token) { | |
//NOTE: do nothing =) | |
} | |
function appendComment(p, token) { | |
p._appendCommentNode(token, p.openElements.current) | |
} | |
function appendCommentToRootHtmlElement(p, token) { | |
p._appendCommentNode(token, p.openElements.items[0]); | |
} | |
function appendCommentToDocument(p, token) { | |
p._appendCommentNode(token, p.document); | |
} | |
function insertCharacters(p, token) { | |
p._insertCharacters(token); | |
} | |
function stopParsing(p, token) { | |
p.stopped = true; | |
} | |
//12.2.5.4.1 The "initial" insertion mode | |
//------------------------------------------------------------------ | |
function doctypeInInitialMode(p, token) { | |
p._setDocumentType(token); | |
if (token.forceQuirks || Doctype.isQuirks(token.name, token.publicId, token.systemId)) | |
p.treeAdapter.setQuirksMode(p.document); | |
p.insertionMode = BEFORE_HTML_MODE; | |
} | |
function tokenInInitialMode(p, token) { | |
p.treeAdapter.setQuirksMode(p.document); | |
p.insertionMode = BEFORE_HTML_MODE; | |
p._processToken(token); | |
} | |
//12.2.5.4.2 The "before html" insertion mode | |
//------------------------------------------------------------------ | |
function startTagBeforeHtml(p, token) { | |
if (token.tagName === $.HTML) { | |
p._insertElement(token, NS.HTML); | |
p.insertionMode = BEFORE_HEAD_MODE; | |
} | |
else | |
tokenBeforeHtml(p, token); | |
} | |
function endTagBeforeHtml(p, token) { | |
var tn = token.tagName; | |
if (tn === $.HTML || tn === $.HEAD || tn === $.BODY || tn === $.BR) | |
tokenBeforeHtml(p, token); | |
} | |
function tokenBeforeHtml(p, token) { | |
p._insertFakeRootElement(); | |
p.insertionMode = BEFORE_HEAD_MODE; | |
p._processToken(token); | |
} | |
//12.2.5.4.3 The "before head" insertion mode | |
//------------------------------------------------------------------ | |
function startTagBeforeHead(p, token) { | |
var tn = token.tagName; | |
if (tn === $.HTML) | |
startTagInBody(p, token); | |
else if (tn === $.HEAD) { | |
p._insertElement(token, NS.HTML); | |
p.headElement = p.openElements.current; | |
p.insertionMode = IN_HEAD_MODE; | |
} | |
else | |
tokenBeforeHead(p, token); | |
} | |
function endTagBeforeHead(p, token) { | |
var tn = token.tagName; | |
if (tn === $.HEAD || tn === $.BODY || tn === $.HTML || tn === $.BR) | |
tokenBeforeHead(p, token); | |
} | |
function tokenBeforeHead(p, token) { | |
p._processFakeStartTag($.HEAD); | |
p._processToken(token); | |
} | |
//12.2.5.4.4 The "in head" insertion mode | |
//------------------------------------------------------------------ | |
function startTagInHead(p, token) { | |
var tn = token.tagName; | |
if (tn === $.HTML) | |
startTagInBody(p, token); | |
else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || | |
tn === $.COMMAND || tn === $.LINK || tn === $.META) { | |
p._appendElement(token, NS.HTML); | |
} | |
else if (tn === $.TITLE) | |
p._switchToTextParsing(token, Tokenizer.RCDATA_STATE); | |
//NOTE: here we assume that we always act as an interactive user agent with enabled scripting, so we parse | |
//<noscript> as a rawtext. | |
else if (tn === $.NOSCRIPT || tn === $.NOFRAMES || tn === $.STYLE) | |
p._switchToTextParsing(token, Tokenizer.RAWTEXT_STATE); | |
else if (tn === $.SCRIPT) { | |
p._insertElement(token, NS.HTML); | |
p.tokenizer.state = Tokenizer.SCRIPT_DATA_STATE; | |
p.originalInsertionMode = p.insertionMode; | |
p.insertionMode = TEXT_MODE; | |
} | |
else if (tn !== $.HEAD) | |
tokenInHead(p, token); | |
} | |
function endTagInHead(p, token) { | |
var tn = token.tagName; | |
if (tn === $.HEAD) { | |
p.openElements.pop(); | |
p.insertionMode = AFTER_HEAD_MODE; | |
} | |
else if (tn === $.BODY || tn === $.BR || tn === $.HTML) | |
tokenInHead(p, token); | |
} | |
function tokenInHead(p, token) { | |
p._processFakeEndTag($.HEAD); | |
p._processToken(token); | |
} | |
//12.2.5.4.6 The "after head" insertion mode | |
//------------------------------------------------------------------ | |
function startTagAfterHead(p, token) { | |
var tn = token.tagName; | |
if (tn === $.HTML) | |
startTagInBody(p, token); | |
else if (tn === $.BODY) { | |
p._insertElement(token, NS.HTML); | |
p.framesetOk = false; | |
p.insertionMode = IN_BODY_MODE; | |
} | |
else if (tn === $.FRAMESET) { | |
p._insertElement(token, NS.HTML); | |
p.insertionMode = IN_FRAMESET_MODE; | |
} | |
else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META || | |
tn === $.NOFRAMES || tn === $.SCRIPT || tn === $.STYLE || tn === $.TITLE) { | |
p.openElements.push(p.headElement); | |
startTagInHead(p, token); | |
p.openElements.remove(p.headElement); | |
} | |
else if (tn !== $.HEAD) | |
tokenAfterHead(p, token); | |
} | |
function endTagAfterHead(p, token) { | |
var tn = token.tagName; | |
if (tn === $.BODY || tn === $.HTML || tn === $.BR) | |
tokenAfterHead(p, token); | |
} | |
function tokenAfterHead(p, token) { | |
p._processFakeStartTag($.BODY); | |
p.framesetOk = true; | |
p._processToken(token); | |
} | |
//12.2.5.4.7 The "in body" insertion mode | |
//------------------------------------------------------------------ | |
function whitespaceCharacterInBody(p, token) { | |
p._reconstructActiveFormattingElements(); | |
p._insertCharacters(token); | |
} | |
function characterInBody(p, token) { | |
p._reconstructActiveFormattingElements(); | |
p._insertCharacters(token); | |
p.framesetOk = false; | |
} | |
function htmlStartTagInBody(p, token) { | |
p.treeAdapter.adoptAttributes(p.openElements.items[0], token.attrs); | |
} | |
function bodyStartTagInBody(p, token) { | |
var bodyElement = p.openElements.tryPeekProperlyNestedBodyElement(); | |
if (bodyElement) { | |
p.framesetOk = false; | |
p.treeAdapter.adoptAttributes(bodyElement, token.attrs); | |
} | |
} | |
function framesetStartTagInBody(p, token) { | |
var bodyElement = p.openElements.tryPeekProperlyNestedBodyElement(); | |
if (p.framesetOk && bodyElement) { | |
p.treeAdapter.detachNode(bodyElement); | |
p.openElements.popAllUpToHtmlElement(); | |
p._insertElement(token, NS.HTML); | |
p.insertionMode = IN_FRAMESET_MODE; | |
} | |
} | |
function addressStartTagInBody(p, token) { | |
if (p.openElements.hasInButtonScope($.P)) | |
p._closePElement(); | |
p._insertElement(token, NS.HTML); | |
} | |
function numberedHeaderStartTagInBody(p, token) { | |
if (p.openElements.hasInButtonScope($.P)) | |
p._closePElement(); | |
var tn = p.openElements.currentTagName; | |
if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) | |
p.openElements.pop(); | |
p._insertElement(token, NS.HTML); | |
} | |
function preStartTagInBody(p, token) { | |
if (p.openElements.hasInButtonScope($.P)) | |
p._closePElement(); | |
p._insertElement(token, NS.HTML); | |
//NOTE: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move | |
//on to the next one. (Newlines at the start of pre blocks are ignored as an authoring convenience.) | |
p.skipNextNewLine = true; | |
p.framesetOk = false; | |
} | |
function formStartTagInBody(p, token) { | |
if (!p.formElement) { | |
if (p.openElements.hasInButtonScope($.P)) | |
p._closePElement(); | |
p._insertElement(token, NS.HTML); | |
p.formElement = p.openElements.current; | |
} | |
} | |
function listItemStartTagInBody(p, token) { | |
p.framesetOk = false; | |
for (var i = p.openElements.stackTop; i >= 0; i--) { | |
var element = p.openElements.items[i], | |
tn = p.treeAdapter.getTagName(element); | |
if ((token.tagName === $.LI && tn === $.LI) || | |
((token.tagName === $.DD || token.tagName === $.DT) && (tn === $.DD || tn == $.DT))) { | |
p._processFakeEndTag(tn); | |
break; | |
} | |
if (tn !== $.ADDRESS && tn !== $.DIV && tn !== $.P && p._isSpecialElement(element)) | |
break; | |
} | |
if (p.openElements.hasInButtonScope($.P)) | |
p._closePElement(); | |
p._insertElement(token, NS.HTML); | |
} | |
function plaintextStartTagInBody(p, token) { | |
if (p.openElements.hasInButtonScope($.P)) | |
p._closePElement(); | |
p._insertElement(token, NS.HTML); | |
p.tokenizer.state = Tokenizer.PLAINTEXT_STATE; | |
} | |
function buttonStartTagInBody(p, token) { | |
if (p.openElements.hasInScope($.BUTTON)) { | |
p._processFakeEndTag($.BUTTON); | |
buttonStartTagInBody(p, token); | |
} | |
else { | |
p._reconstructActiveFormattingElements(); | |
p._insertElement(token, NS.HTML); | |
p.framesetOk = false; | |
} | |
} | |
function aStartTagInBody(p, token) { | |
var activeElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName($.A); | |
if (activeElementEntry) { | |
p._processFakeEndTag($.A); | |
p.openElements.remove(activeElementEntry.element); | |
p.activeFormattingElements.removeEntry(activeElementEntry); | |
} | |
p._reconstructActiveFormattingElements(); | |
p._insertElement(token, NS.HTML); | |
p.activeFormattingElements.pushElement(p.openElements.current, token); | |
} | |
function bStartTagInBody(p, token) { | |
p._reconstructActiveFormattingElements(); | |
p._insertElement(token, NS.HTML); | |
p.activeFormattingElements.pushElement(p.openElements.current, token); | |
} | |
function nobrStartTagInBody(p, token) { | |
p._reconstructActiveFormattingElements(); | |
if (p.openElements.hasInScope($.NOBR)) { | |
p._processFakeEndTag($.NOBR); | |
p._reconstructActiveFormattingElements(); | |
} | |
p._insertElement(token, NS.HTML); | |
p.activeFormattingElements.pushElement(p.openElements.current, token); | |
} | |
function appletStartTagInBody(p, token) { | |
p._reconstructActiveFormattingElements(); | |
p._insertElement(token, NS.HTML); | |
p.activeFormattingElements.insertMarker(); | |
p.framesetOk = false; | |
} | |
function tableStartTagInBody(p, token) { | |
if (!p.treeAdapter.isQuirksMode(p.document) && p.openElements.hasInButtonScope($.P)) | |
p._closePElement(); | |
p._insertElement(token, NS.HTML); | |
p.framesetOk = false; | |
p.insertionMode = IN_TABLE_MODE; | |
} | |
function areaStartTagInBody(p, token) { | |
p._reconstructActiveFormattingElements(); | |
p._appendElement(token, NS.HTML); | |
p.framesetOk = false; | |
} | |
function inputStartTagInBody(p, token) { | |
p._reconstructActiveFormattingElements(); | |
p._appendElement(token, NS.HTML); | |
var inputType = Tokenizer.getTokenAttr(token, ATTRS.TYPE); | |
if (!inputType || inputType.toLowerCase() !== HIDDEN_INPUT_TYPE) | |
p.framesetOk = false; | |
} | |
function paramStartTagInBody(p, token) { | |
p._appendElement(token, NS.HTML); | |
} | |
function hrStartTagInBody(p, token) { | |
if (p.openElements.hasInButtonScope($.P)) | |
p._closePElement(); | |
p._appendElement(token, NS.HTML); | |
p.framesetOk = false; | |
} | |
function imageStartTagInBody(p, token) { | |
token.tagName = $.IMG; | |
areaStartTagInBody(p, token); | |
} | |
function isindexStartTagInBody(p, token) { | |
if (!p.formElement) { | |
p._processFakeStartTagWithAttrs($.FORM, getSearchableIndexFormAttrs(token)); | |
p._processFakeStartTag($.HR); | |
p._processFakeStartTag($.LABEL); | |
p.treeAdapter.insertText(p.openElements.current, getSearchableIndexLabelText(token)); | |
p._processFakeStartTagWithAttrs($.INPUT, getSearchableIndexInputAttrs(token)); | |
p._processFakeEndTag($.LABEL); | |
p._processFakeStartTag($.HR); | |
p._processFakeEndTag($.FORM); | |
} | |
} | |
function textareaStartTagInBody(p, token) { | |
p._insertElement(token, NS.HTML); | |
//NOTE: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move | |
//on to the next one. (Newlines at the start of textarea elements are ignored as an authoring convenience.) | |
p.skipNextNewLine = true; | |
p.tokenizer.state = Tokenizer.RCDATA_STATE; | |
p.originalInsertionMode = p.insertionMode; | |
p.framesetOk = false; | |
p.insertionMode = TEXT_MODE; | |
} | |
function xmpStartTagInBody(p, token) { | |
if (p.openElements.hasInButtonScope($.P)) | |
p._closePElement(); | |
p._reconstructActiveFormattingElements(); | |
p.framesetOk = false; | |
p._switchToTextParsing(token, Tokenizer.RAWTEXT_STATE); | |
} | |
function iframeStartTagInBody(p, token) { | |
p.framesetOk = false; | |
p._switchToTextParsing(token, Tokenizer.RAWTEXT_STATE); | |
} | |
//NOTE: here we assume that we always act as an user agent with enabled plugins, so we parse | |
//<noembed> as a rawtext. | |
function noembedStartTagInBody(p, token) { | |
p._switchToTextParsing(token, Tokenizer.RAWTEXT_STATE); | |
} | |
function selectStartTagInBody(p, token) { | |
p._reconstructActiveFormattingElements(); | |
p._insertElement(token, NS.HTML); | |
p.framesetOk = false; | |
if (p.insertionMode === IN_TABLE_MODE || p.insertionMode === IN_CAPTION_MODE || | |
p.insertionMode === IN_TABLE_BODY_MODE || p.insertionMode === IN_ROW_MODE || | |
p.insertionMode === IN_CELL_MODE) { | |
p.insertionMode = IN_SELECT_IN_TABLE_MODE; | |
} | |
else | |
p.insertionMode = IN_SELECT_MODE; | |
} | |
function optgroupStartTagInBody(p, token) { | |
if (p.openElements.currentTagName === $.OPTION) | |
p._processFakeEndTag($.OPTION); | |
p._reconstructActiveFormattingElements(); | |
p._insertElement(token, NS.HTML); | |
} | |
function rpStartTagInBody(p, token) { | |
if (p.openElements.hasInScope($.RUBY)) | |
p.openElements.generateImpliedEndTags(); | |
p._insertElement(token, NS.HTML); | |
} | |
function menuitemStartTagInBody(p, token) { | |
p._appendElement(token, NS.HTML); | |
} | |
function mathStartTagInBody(p, token) { | |
p._reconstructActiveFormattingElements(); | |
ForeignContent.adjustTokenMathMLAttrs(token); | |
ForeignContent.adjustTokenXMLAttrs(token); | |
if (token.selfClosing) | |
p._appendElement(token, NS.MATHML); | |
else | |
p._insertElement(token, NS.MATHML); | |
} | |
function svgStartTagInBody(p, token) { | |
p._reconstructActiveFormattingElements(); | |
ForeignContent.adjustTokenSVGAttrs(token); | |
ForeignContent.adjustTokenXMLAttrs(token); | |
if (token.selfClosing) | |
p._appendElement(token, NS.SVG); | |
else | |
p._insertElement(token, NS.SVG); | |
} | |
function genericStartTagInBody(p, token) { | |
p._reconstructActiveFormattingElements(); | |
p._insertElement(token, NS.HTML); | |
} | |
//OPTIMIZATION: Integer comparisons are low-cost, so we can use very fast tag name length filters here. | |
//It's faster than using dictionary. | |
function startTagInBody(p, token) { | |
var tn = token.tagName; | |
switch (tn.length) { | |
case 1: | |
if (tn === $.I || tn === $.S || tn === $.B || tn === $.U) | |
bStartTagInBody(p, token); | |
else if (tn === $.P) | |
addressStartTagInBody(p, token); | |
else if (tn === $.A) | |
aStartTagInBody(p, token); | |
else | |
genericStartTagInBody(p, token); | |
break; | |
case 2: | |
if (tn === $.DL || tn === $.OL || tn === $.UL) | |
addressStartTagInBody(p, token); | |
else if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) | |
numberedHeaderStartTagInBody(p, token); | |
else if (tn === $.LI || tn === $.DD || tn === $.DT) | |
listItemStartTagInBody(p, token); | |
else if (tn === $.EM || tn === $.TT) | |
bStartTagInBody(p, token); | |
else if (tn === $.BR) | |
areaStartTagInBody(p, token); | |
else if (tn === $.HR) | |
hrStartTagInBody(p, token); | |
else if (tn === $.RP || tn === $.RT) | |
rpStartTagInBody(p, token); | |
else if (tn !== $.TH && tn !== $.TD && tn !== $.TR) | |
genericStartTagInBody(p, token); | |
break; | |
case 3: | |
if (tn === $.DIV || tn === $.DIR || tn === $.NAV) | |
addressStartTagInBody(p, token); | |
else if (tn === $.PRE) | |
preStartTagInBody(p, token); | |
else if (tn === $.BIG) | |
bStartTagInBody(p, token); | |
else if (tn === $.IMG || tn === $.WBR) | |
areaStartTagInBody(p, token); | |
else if (tn === $.XMP) | |
xmpStartTagInBody(p, token); | |
else if (tn === $.SVG) | |
svgStartTagInBody(p, token); | |
else if (tn !== $.COL) | |
genericStartTagInBody(p, token); | |
break; | |
case 4: | |
if (tn === $.HTML) | |
htmlStartTagInBody(p, token); | |
else if (tn === $.BASE || tn === $.LINK || tn === $.META) | |
startTagInHead(p, token); | |
else if (tn === $.BODY) | |
bodyStartTagInBody(p, token); | |
else if (tn === $.MAIN || tn === $.MENU) | |
addressStartTagInBody(p, token); | |
else if (tn === $.FORM) | |
formStartTagInBody(p, token); | |
else if (tn === $.CODE || tn === $.FONT) | |
bStartTagInBody(p, token); | |
else if (tn === $.NOBR) | |
nobrStartTagInBody(p, token); | |
else if (tn === $.AREA) | |
areaStartTagInBody(p, token); | |
else if (tn === $.MATH) | |
mathStartTagInBody(p, token); | |
else if (tn !== $.HEAD) | |
genericStartTagInBody(p, token); | |
break; | |
case 5: | |
if (tn === $.STYLE || tn === $.TITLE) | |
startTagInHead(p, token); | |
else if (tn === $.ASIDE) | |
addressStartTagInBody(p, token); | |
else if (tn === $.SMALL) | |
bStartTagInBody(p, token); | |
else if (tn === $.TABLE) | |
tableStartTagInBody(p, token); | |
else if (tn === $.EMBED) | |
areaStartTagInBody(p, token); | |
else if (tn === $.INPUT) | |
inputStartTagInBody(p, token); | |
else if (tn === $.PARAM || tn === $.TRACK) | |
paramStartTagInBody(p, token); | |
else if (tn === $.IMAGE) | |
imageStartTagInBody(p, token); | |
else if (tn !== $.FRAME && tn !== $.TBODY && tn !== $.TFOOT && tn !== $.THEAD) | |
genericStartTagInBody(p, token); | |
break; | |
case 6: | |
if (tn === $.SCRIPT) | |
startTagInHead(p, token); | |
else if (tn === $.CENTER || tn === $.FIGURE || tn === $.FOOTER || tn === $.HEADER || tn === $.HGROUP) | |
addressStartTagInBody(p, token); | |
else if (tn === $.BUTTON) | |
buttonStartTagInBody(p, token); | |
else if (tn === $.STRIKE || tn === $.STRONG) | |
bStartTagInBody(p, token); | |
else if (tn === $.APPLET || tn === $.OBJECT) | |
appletStartTagInBody(p, token); | |
else if (tn === $.KEYGEN) | |
areaStartTagInBody(p, token); | |
else if (tn === $.SOURCE) | |
paramStartTagInBody(p, token); | |
else if (tn === $.IFRAME) | |
iframeStartTagInBody(p, token); | |
else if (tn === $.SELECT) | |
selectStartTagInBody(p, token); | |
else if (tn === $.OPTION) | |
optgroupStartTagInBody(p, token); | |
else | |
genericStartTagInBody(p, token); | |
break; | |
case 7: | |
if (tn === $.BGSOUND || tn === $.COMMAND) | |
startTagInHead(p, token); | |
else if (tn === $.DETAILS || tn === $.ADDRESS || tn === $.ARTICLE || tn === $.SECTION || tn === $.SUMMARY) | |
addressStartTagInBody(p, token); | |
else if (tn === $.LISTING) | |
preStartTagInBody(p, token); | |
else if (tn === $.MARQUEE) | |
appletStartTagInBody(p, token); | |
else if (tn === $.ISINDEX) | |
isindexStartTagInBody(p, token); | |
else if (tn === $.NOEMBED) | |
noembedStartTagInBody(p, token); | |
else if (tn !== $.CAPTION) | |
genericStartTagInBody(p, token); | |
break; | |
case 8: | |
if (tn === $.BASEFONT || tn === $.MENUITEM) | |
menuitemStartTagInBody(p, token); | |
else if (tn === $.FRAMESET) | |
framesetStartTagInBody(p, token); | |
else if (tn === $.FIELDSET) | |
addressStartTagInBody(p, token); | |
else if (tn === $.TEXTAREA) | |
textareaStartTagInBody(p, token); | |
else if (tn === $.NOSCRIPT) | |
noembedStartTagInBody(p, token); | |
else if (tn === $.OPTGROUP) | |
optgroupStartTagInBody(p, token); | |
else if (tn !== $.COLGROUP) | |
genericStartTagInBody(p, token); | |
break; | |
case 9: | |
if (tn === $.PLAINTEXT) | |
plaintextStartTagInBody(p, token); | |
else | |
genericStartTagInBody(p, token); | |
break; | |
case 10: | |
if (tn === $.BLOCKQUOTE || tn === $.FIGCAPTION) | |
addressStartTagInBody(p, token); | |
else | |
genericStartTagInBody(p, token); | |
break; | |
default: | |
genericStartTagInBody(p, token); | |
} | |
} | |
function bodyEndTagInBody(p, token) { | |
if (p.openElements.hasInScope($.BODY)) | |
p.insertionMode = AFTER_BODY_MODE; | |
else | |
token.ignored = true; | |
} | |
function htmlEndTagInBody(p, token) { | |
var fakeToken = p._processFakeEndTag($.BODY); | |
if (!fakeToken.ignored) | |
p._processToken(token); | |
} | |
function addressEndTagInBody(p, token) { | |
var tn = token.tagName; | |
if (p.openElements.hasInScope(tn)) { | |
p.openElements.generateImpliedEndTags(); | |
p.openElements.popUntilTagNamePopped(tn); | |
} | |
} | |
function formEndTagInBody(p, token) { | |
var formElement = p.formElement; | |
p.formElement = null; | |
if (formElement && p.openElements.hasInScope($.FORM)) { | |
p.openElements.generateImpliedEndTags(); | |
p.openElements.remove(formElement); | |
} | |
} | |
function pEndTagInBody(p, token) { | |
if (p.openElements.hasInButtonScope($.P)) { | |
p.openElements.generateImpliedEndTagsWithExclusion($.P); | |
p.openElements.popUntilTagNamePopped($.P); | |
} | |
else { | |
p._processFakeStartTag($.P); | |
p._processToken(token); | |
} | |
} | |
function liEndTagInBody(p, token) { | |
if (p.openElements.hasInListItemScope($.LI)) { | |
p.openElements.generateImpliedEndTagsWithExclusion($.LI); | |
p.openElements.popUntilTagNamePopped($.LI); | |
} | |
} | |
function ddEndTagInBody(p, token) { | |
var tn = token.tagName; | |
if (p.openElements.hasInScope(tn)) { | |
p.openElements.generateImpliedEndTagsWithExclusion(tn); | |
p.openElements.popUntilTagNamePopped(tn); | |
} | |
} | |
function numberedHeaderEndTagInBody(p, token) { | |
if (p.openElements.hasNumberedHeaderInScope()) { | |
p.openElements.generateImpliedEndTags(); | |
p.openElements.popUntilNumberedHeaderPopped(); | |
} | |
} | |
function appletEndTagInBody(p, token) { | |
var tn = token.tagName; | |
if (p.openElements.hasInScope(tn)) { | |
p.openElements.generateImpliedEndTags(); | |
p.openElements.popUntilTagNamePopped(tn); | |
p.activeFormattingElements.clearToLastMarker(); | |
} | |
} | |
function brEndTagInBody(p, token) { | |
p._processFakeStartTag($.BR); | |
} | |
function genericEndTagInBody(p, token) { | |
var tn = token.tagName; | |
for (var i = p.openElements.stackTop; i > 0; i--) { | |
var element = p.openElements.items[i]; | |
if (p.treeAdapter.getTagName(element) === tn) { | |
p.openElements.generateImpliedEndTagsWithExclusion(tn); | |
p.openElements.popUntilElementPopped(element); | |
break; | |
} | |
if (p._isSpecialElement(element)) | |
break; | |
} | |
} | |
//OPTIMIZATION: Integer comparisons are low-cost, so we can use very fast tag name length filters here. | |
//It's faster than using dictionary. | |
function endTagInBody(p, token) { | |
var tn = token.tagName; | |
switch (tn.length) { | |
case 1: | |
if (tn === $.A || tn === $.B || tn === $.I || tn === $.S || tn == $.U) | |
p._callAdoptionAgency(token); | |
else if (tn === $.P) | |
pEndTagInBody(p, token); | |
else | |
genericEndTagInBody(p, token); | |
break; | |
case 2: | |
if (tn == $.DL || tn === $.UL || tn === $.OL) | |
addressEndTagInBody(p, token); | |
else if (tn === $.LI) | |
liEndTagInBody(p, token); | |
else if (tn === $.DD || tn === $.DT) | |
ddEndTagInBody(p, token); | |
else if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) | |
numberedHeaderEndTagInBody(p, token); | |
else if (tn === $.BR) | |
brEndTagInBody(p, token); | |
else if (tn === $.EM || tn === $.TT) | |
p._callAdoptionAgency(token); | |
else | |
genericEndTagInBody(p, token); | |
break; | |
case 3: | |
if (tn === $.BIG) | |
p._callAdoptionAgency(token); | |
else if (tn === $.DIR || tn === $.DIV || tn === $.NAV) | |
addressEndTagInBody(p, token); | |
else | |
genericEndTagInBody(p, token); | |
break; | |
case 4: | |
if (tn === $.BODY) | |
bodyEndTagInBody(p, token); | |
else if (tn === $.HTML) | |
htmlEndTagInBody(p, token); | |
else if (tn === $.FORM) | |
formEndTagInBody(p, token); | |
else if (tn === $.CODE || tn === $.FONT || tn === $.NOBR) | |
p._callAdoptionAgency(token); | |
else if (tn === $.MAIN || tn === $.MENU) | |
addressEndTagInBody(p, token); | |
else | |
genericEndTagInBody(p, token); | |
break; | |
case 5: | |
if (tn === $.ASIDE) | |
addressEndTagInBody(p, token); | |
else if (tn === $.SMALL) | |
p._callAdoptionAgency(token); | |
else | |
genericEndTagInBody(p, token); | |
break; | |
case 6: | |
if (tn === $.CENTER || tn === $.FIGURE || tn === $.FOOTER || tn === $.HEADER || tn === $.HGROUP) | |
addressEndTagInBody(p, token); | |
else if (tn === $.APPLET || tn === $.OBJECT) | |
appletEndTagInBody(p, token); | |
else if (tn == $.STRIKE || tn === $.STRONG) | |
p._callAdoptionAgency(token); | |
else | |
genericEndTagInBody(p, token); | |
break; | |
case 7: | |
if (tn === $.ADDRESS || tn === $.ARTICLE || tn === $.DETAILS || tn === $.SECTION || tn === $.SUMMARY) | |
addressEndTagInBody(p, token); | |
else if (tn === $.MARQUEE) | |
appletEndTagInBody(p, token); | |
else | |
genericEndTagInBody(p, token); | |
break; | |
case 8: | |
if (tn === $.FIELDSET) | |
addressEndTagInBody(p, token); | |
else | |
genericEndTagInBody(p, token); | |
break; | |
case 10: | |
if (tn === $.BLOCKQUOTE || tn === $.FIGCAPTION) | |
addressEndTagInBody(p, token); | |
else | |
genericEndTagInBody(p, token); | |
break; | |
default : | |
genericEndTagInBody(p, token); | |
} | |
} | |
//12.2.5.4.8 The "text" insertion mode | |
//------------------------------------------------------------------ | |
function endTagInText(p, token) { | |
//NOTE: we are not in interactive user agent, so we don't process script here and just pop it out of the open | |
//element stack like any other end tag. | |
p.openElements.pop(); | |
p.insertionMode = p.originalInsertionMode; | |
} | |
function eofInText(p, token) { | |
p.openElements.pop(); | |
p.insertionMode = p.originalInsertionMode; | |
p._processToken(token); | |
} | |
//12.2.5.4.9 The "in table" insertion mode | |
//------------------------------------------------------------------ | |
function characterInTable(p, token) { | |
var curTn = p.openElements.currentTagName; | |
if (curTn === $.TABLE || curTn === $.TBODY || curTn === $.TFOOT || curTn === $.THEAD || curTn === $.TR) { | |
p.pendingCharacterTokens = []; | |
p.hasNonWhitespacePendingCharacterToken = false; | |
p.originalInsertionMode = p.insertionMode; | |
p.insertionMode = IN_TABLE_TEXT_MODE; | |
p._processToken(token); | |
} | |
else | |
tokenInTable(p, token); | |
} | |
function captionStartTagInTable(p, token) { | |
p.openElements.clearBackToTableContext(); | |
p.activeFormattingElements.insertMarker(); | |
p._insertElement(token, NS.HTML); | |
p.insertionMode = IN_CAPTION_MODE; | |
} | |
function colgroupStartTagInTable(p, token) { | |
p.openElements.clearBackToTableContext(); | |
p._insertElement(token, NS.HTML); | |
p.insertionMode = IN_COLUMN_GROUP_MODE; | |
} | |
function colStartTagInTable(p, token) { | |
p._processFakeStartTag($.COLGROUP); | |
p._processToken(token); | |
} | |
function tbodyStartTagInTable(p, token) { | |
p.openElements.clearBackToTableContext(); | |
p._insertElement(token, NS.HTML); | |
p.insertionMode = IN_TABLE_BODY_MODE; | |
} | |
function tdStartTagInTable(p, token) { | |
p._processFakeStartTag($.TBODY); | |
p._processToken(token); | |
} | |
function tableStartTagInTable(p, token) { | |
var fakeToken = p._processFakeEndTag($.TABLE); | |
//NOTE: The fake end tag token here can only be ignored in the fragment case. | |
if (!fakeToken.ignored) | |
p._processToken(token); | |
} | |
function inputStartTagInTable(p, token) { | |
var inputType = Tokenizer.getTokenAttr(token, ATTRS.TYPE); | |
if (inputType && inputType.toLowerCase() === HIDDEN_INPUT_TYPE) | |
p._appendElement(token, NS.HTML); | |
else | |
tokenInTable(p, token); | |
} | |
function formStartTagInTable(p, token) { | |
if (!p.formElement) { | |
p._insertElement(token, NS.HTML); | |
p.formElement = p.openElements.current; | |
p.openElements.pop(); | |
} | |
} | |
function startTagInTable(p, token) { | |
var tn = token.tagName; | |
switch (tn.length) { | |
case 2: | |
if (tn === $.TD || tn === $.TH || tn === $.TR) | |
tdStartTagInTable(p, token); | |
else | |
tokenInTable(p, token); | |
break; | |
case 3: | |
if (tn === $.COL) | |
colStartTagInTable(p, token); | |
else | |
tokenInTable(p, token); | |
break; | |
case 4: | |
if (tn === $.FORM) | |
formStartTagInTable(p, token); | |
else | |
tokenInTable(p, token); | |
break; | |
case 5: | |
if (tn === $.TABLE) | |
tableStartTagInTable(p, token); | |
else if (tn === $.STYLE) | |
startTagInHead(p, token); | |
else if (tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD) | |
tbodyStartTagInTable(p, token); | |
else if (tn === $.INPUT) | |
inputStartTagInTable(p, token); | |
else | |
tokenInTable(p, token); | |
break; | |
case 6: | |
if (tn === $.SCRIPT) | |
startTagInHead(p, token); | |
else | |
tokenInTable(p, token); | |
break; | |
case 7: | |
if (tn === $.CAPTION) | |
captionStartTagInTable(p, token); | |
else | |
tokenInTable(p, token); | |
break; | |
case 8: | |
if (tn === $.COLGROUP) | |
colgroupStartTagInTable(p, token); | |
else | |
tokenInTable(p, token); | |
break; | |
default: | |
tokenInTable(p, token); | |
} | |
} | |
function endTagInTable(p, token) { | |
var tn = token.tagName; | |
if (tn === $.TABLE) { | |
if (p.openElements.hasInTableScope($.TABLE)) { | |
p.openElements.popUntilTagNamePopped($.TABLE); | |
p._resetInsertionModeAppropriately(); | |
} | |
else | |
token.ignored = true; | |
} | |
else if (tn !== $.BODY && tn !== $.CAPTION && tn !== $.COL && tn !== $.COLGROUP && tn !== $.HTML && | |
tn !== $.TBODY && tn !== $.TD && tn !== $.TFOOT && tn !== $.TH && tn !== $.THEAD && tn !== $.TR) { | |
tokenInTable(p, token); | |
} | |
} | |
function tokenInTable(p, token) { | |
var savedFosterParentingState = p.fosterParentingEnabled; | |
p.fosterParentingEnabled = true; | |
p._processTokenInBodyMode(token); | |
p.fosterParentingEnabled = savedFosterParentingState; | |
} | |
//12.2.5.4.10 The "in table text" insertion mode | |
//------------------------------------------------------------------ | |
function whitespaceCharacterInTableText(p, token) { | |
p.pendingCharacterTokens.push(token); | |
} | |
function characterInTableText(p, token) { | |
p.pendingCharacterTokens.push(token); | |
p.hasNonWhitespacePendingCharacterToken = true; | |
} | |
function tokenInTableText(p, token) { | |
if (p.hasNonWhitespacePendingCharacterToken) { | |
for (var i = 0; i < p.pendingCharacterTokens.length; i++) | |
tokenInTable(p, p.pendingCharacterTokens[i]); | |
} | |
else { | |
for (var i = 0; i < p.pendingCharacterTokens.length; i++) | |
p._insertCharacters(p.pendingCharacterTokens[i]); | |
} | |
p.insertionMode = p.originalInsertionMode; | |
p._processToken(token); | |
} | |
//12.2.5.4.11 The "in caption" insertion mode | |
//------------------------------------------------------------------ | |
function startTagInCaption(p, token) { | |
var tn = token.tagName; | |
if (tn === $.CAPTION || tn === $.COL || tn === $.COLGROUP || tn === $.TBODY || | |
tn === $.TD || tn === $.TFOOT || tn === $.TH || tn === $.THEAD || tn === $.TR) { | |
var fakeToken = p._processFakeEndTag($.CAPTION); | |
//NOTE: The fake end tag token here can only be ignored in the fragment case. | |
if (!fakeToken.ignored) | |
p._processToken(token); | |
} | |
else | |
startTagInBody(p, token); | |
} | |
function endTagInCaption(p, token) { | |
var tn = token.tagName; | |
if (tn === $.CAPTION) { | |
if (p.openElements.hasInTableScope($.CAPTION)) { | |
p.openElements.generateImpliedEndTags(); | |
p.openElements.popUntilTagNamePopped($.CAPTION); | |
p.activeFormattingElements.clearToLastMarker(); | |
p.insertionMode = IN_TABLE_MODE; | |
} | |
else | |
token.ignored = true; | |
} | |
else if (tn === $.TABLE) { | |
var fakeToken = p._processFakeEndTag($.CAPTION); | |
//NOTE: The fake end tag token here can only be ignored in the fragment case. | |
if (!fakeToken.ignored) | |
p._processToken(token); | |
} | |
else if (tn !== $.BODY && tn !== $.COL && tn !== $.COLGROUP && tn !== $.HTML && tn !== $.TBODY && | |
tn !== $.TD && tn !== $.TFOOT && tn !== $.TH && tn !== $.THEAD && tn !== $.TR) { | |
endTagInBody(p, token); | |
} | |
} | |
//12.2.5.4.12 The "in column group" insertion mode | |
//------------------------------------------------------------------ | |
function startTagInColumnGroup(p, token) { | |
var tn = token.tagName; | |
if (tn === $.HTML) | |
startTagInBody(p, token); | |
else if (tn === $.COL) | |
p._appendElement(token, NS.HTML); | |
else | |
tokenInColumnGroup(p, token); | |
} | |
function endTagInColumnGroup(p, token) { | |
var tn = token.tagName; | |
if (tn === $.COLGROUP) { | |
if (p.openElements.isRootHtmlElementCurrent()) | |
token.ignored = true; | |
else { | |
p.openElements.pop(); | |
p.insertionMode = IN_TABLE_MODE; | |
} | |
} | |
else if (tn !== $.COL) | |
tokenInColumnGroup(p, token); | |
} | |
function tokenInColumnGroup(p, token) { | |
var fakeToken = p._processFakeEndTag($.COLGROUP); | |
//NOTE: The fake end tag token here can only be ignored in the fragment case. | |
if (!fakeToken.ignored) | |
p._processToken(token); | |
} | |
//12.2.5.4.13 The "in table body" insertion mode | |
//------------------------------------------------------------------ | |
function startTagInTableBody(p, token) { | |
var tn = token.tagName; | |
if (tn === $.TR) { | |
p.openElements.clearBackToTableBodyContext(); | |
p._insertElement(token, NS.HTML); | |
p.insertionMode = IN_ROW_MODE; | |
} | |
else if (tn === $.TH || tn === $.TD) { | |
p._processFakeStartTag($.TR); | |
p._processToken(token); | |
} | |
else if (tn === $.CAPTION || tn === $.COL || tn === $.COLGROUP || | |
tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD) { | |
if (p.openElements.hasTableBodyContextInTableScope()) { | |
p.openElements.clearBackToTableBodyContext(); | |
p._processFakeEndTag(p.openElements.currentTagName); | |
p._processToken(token); | |
} | |
} | |
else | |
startTagInTable(p, token); | |
} | |
function endTagInTableBody(p, token) { | |
var tn = token.tagName; | |
if (tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD) { | |
if (p.openElements.hasInTableScope(tn)) { | |
p.openElements.clearBackToTableBodyContext(); | |
p.openElements.pop(); | |
p.insertionMode = IN_TABLE_MODE; | |
} | |
} | |
else if (tn === $.TABLE) { | |
if (p.openElements.hasTableBodyContextInTableScope()) { | |
p.openElements.clearBackToTableBodyContext(); | |
p._processFakeEndTag(p.openElements.currentTagName); | |
p._processToken(token); | |
} | |
} | |
else if (tn !== $.BODY && tn !== $.CAPTION && tn !== $.COL && tn !== $.COLGROUP || | |
tn !== $.HTML && tn !== $.TD && tn !== $.TH && tn !== $.TR) { | |
endTagInTable(p, token); | |
} | |
} | |
//12.2.5.4.14 The "in row" insertion mode | |
//------------------------------------------------------------------ | |
function startTagInRow(p, token) { | |
var tn = token.tagName; | |
if (tn === $.TH || tn === $.TD) { | |
p.openElements.clearBackToTableRowContext(); | |
p._insertElement(token, NS.HTML); | |
p.insertionMode = IN_CELL_MODE; | |
p.activeFormattingElements.insertMarker(); | |
} | |
else if (tn === $.CAPTION || tn === $.COL || tn === $.COLGROUP || tn === $.TBODY || | |
tn === $.TFOOT || tn === $.THEAD || tn === $.TR) { | |
var fakeToken = p._processFakeEndTag($.TR); | |
//NOTE: The fake end tag token here can only be ignored in the fragment case. | |
if (!fakeToken.ignored) | |
p._processToken(token); | |
} | |
else | |
startTagInTable(p, token); | |
} | |
function endTagInRow(p, token) { | |
var tn = token.tagName; | |
if (tn === $.TR) { | |
if (p.openElements.hasInTableScope($.TR)) { | |
p.openElements.clearBackToTableRowContext(); | |
p.openElements.pop(); | |
p.insertionMode = IN_TABLE_BODY_MODE; | |
} | |
else | |
token.ignored = true; | |
} | |
else if (tn === $.TABLE) { | |
var fakeToken = p._processFakeEndTag($.TR); | |
//NOTE: The fake end tag token here can only be ignored in the fragment case. | |
if (!fakeToken.ignored) | |
p._processToken(token); | |
} | |
else if (tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD) { | |
if (p.openElements.hasInTableScope(tn)) { | |
p._processFakeEndTag($.TR); | |
p._processToken(token); | |
} | |
} | |
else if (tn !== $.BODY && tn !== $.CAPTION && tn !== $.COL && tn !== $.COLGROUP || | |
tn !== $.HTML && tn !== $.TD && tn !== $.TH) { | |
endTagInTable(p, token); | |
} | |
} | |
//12.2.5.4.15 The "in cell" insertion mode | |
//------------------------------------------------------------------ | |
function startTagInCell(p, token) { | |
var tn = token.tagName; | |
if (tn === $.CAPTION || tn === $.COL || tn === $.COLGROUP || tn === $.TBODY || | |
tn === $.TD || tn === $.TFOOT || tn === $.TH || tn === $.THEAD || tn === $.TR) { | |
if (p.openElements.hasInTableScope($.TD) || p.openElements.hasInTableScope($.TH)) { | |
p._closeTableCell(); | |
p._processToken(token); | |
} | |
} | |
else | |
startTagInBody(p, token); | |
} | |
function endTagInCell(p, token) { | |
var tn = token.tagName; | |
if (tn === $.TD || tn === $.TH) { | |
if (p.openElements.hasInTableScope(tn)) { | |
p.openElements.generateImpliedEndTags(); | |
p.openElements.popUntilTagNamePopped(tn); | |
p.activeFormattingElements.clearToLastMarker(); | |
p.insertionMode = IN_ROW_MODE; | |
} | |
} | |
else if (tn === $.TABLE || tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD || tn === $.TR) { | |
if (p.openElements.hasInTableScope(tn)) { | |
p._closeTableCell(); | |
p._processToken(token); | |
} | |
} | |
else if (tn !== $.BODY && tn !== $.CAPTION && tn !== $.COL && tn !== $.COLGROUP && tn !== $.HTML) | |
endTagInBody(p, token); | |
} | |
//12.2.5.4.16 The "in select" insertion mode | |
//------------------------------------------------------------------ | |
function startTagInSelect(p, token) { | |
var tn = token.tagName; | |
if (tn === $.HTML) | |
startTagInBody(p, token); | |
else if (tn === $.OPTION) { | |
if (p.openElements.currentTagName === $.OPTION) | |
p._processFakeEndTag($.OPTION); | |
p._insertElement(token, NS.HTML); | |
} | |
else if (tn === $.OPTGROUP) { | |
if (p.openElements.currentTagName === $.OPTION) | |
p._processFakeEndTag($.OPTION); | |
if (p.openElements.currentTagName === $.OPTGROUP) | |
p._processFakeEndTag($.OPTGROUP); | |
p._insertElement(token, NS.HTML); | |
} | |
else if (tn === $.SELECT) | |
p._processFakeEndTag($.SELECT); | |
else if (tn === $.INPUT || tn === $.KEYGEN || tn === $.TEXTAREA) { | |
if (p.openElements.hasInSelectScope($.SELECT)) { | |
p._processFakeEndTag($.SELECT); | |
p._processToken(token); | |
} | |
} | |
else if (tn === $.SCRIPT) | |
startTagInHead(p, token); | |
} | |
function endTagInSelect(p, token) { | |
var tn = token.tagName; | |
if (tn === $.OPTGROUP) { | |
var prevOpenElement = p.openElements.items[p.openElements.stackTop - 1], | |
prevOpenElementTn = prevOpenElement && p.treeAdapter.getTagName(prevOpenElement); | |
if (p.openElements.currentTagName === $.OPTION && prevOpenElementTn === $.OPTGROUP) | |
p._processFakeEndTag($.OPTION); | |
if (p.openElements.currentTagName === $.OPTGROUP) | |
p.openElements.pop(); | |
} | |
else if (tn === $.OPTION) { | |
if (p.openElements.currentTagName === $.OPTION) | |
p.openElements.pop(); | |
} | |
else if (tn === $.SELECT && p.openElements.hasInSelectScope($.SELECT)) { | |
p.openElements.popUntilTagNamePopped($.SELECT); | |
p._resetInsertionModeAppropriately(); | |
} | |
} | |
//12.2.5.4.17 The "in select in table" insertion mode | |
//------------------------------------------------------------------ | |
function startTagInSelectInTable(p, token) { | |
var tn = token.tagName; | |
if (tn === $.CAPTION || tn === $.TABLE || tn === $.TBODY || tn === $.TFOOT || | |
tn === $.THEAD || tn === $.TR || tn === $.TD || tn === $.TH) { | |
p._processFakeEndTag($.SELECT); | |
p._processToken(token); | |
} | |
else | |
startTagInSelect(p, token); | |
} | |
function endTagInSelectInTable(p, token) { | |
var tn = token.tagName; | |
if (tn === $.CAPTION || tn === $.TABLE || tn === $.TBODY || tn === $.TFOOT || | |
tn === $.THEAD || tn === $.TR || tn === $.TD || tn === $.TH) { | |
if (p.openElements.hasInTableScope(tn)) { | |
p._processFakeEndTag($.SELECT); | |
p._processToken(token); | |
} | |
} | |
else | |
endTagInSelect(p, token); | |
} | |
//12.2.5.4.18 The "after body" insertion mode | |
//------------------------------------------------------------------ | |
function startTagAfterBody(p, token) { | |
if (token.tagName === $.HTML) | |
startTagInBody(p, token); | |
else | |
tokenAfterBody(p, token); | |
} | |
function endTagAfterBody(p, token) { | |
if (token.tagName === $.HTML) { | |
if (!p.fragmentContext) | |
p.insertionMode = AFTER_AFTER_BODY_MODE; | |
} | |
else | |
tokenAfterBody(p, token); | |
} | |
function tokenAfterBody(p, token) { | |
p.insertionMode = IN_BODY_MODE; | |
p._processToken(token); | |
} | |
//12.2.5.4.19 The "in frameset" insertion mode | |
//------------------------------------------------------------------ | |
function startTagInFrameset(p, token) { | |
var tn = token.tagName; | |
if (tn === $.HTML) | |
startTagInBody(p, token); | |
else if (tn === $.FRAMESET) | |
p._insertElement(token, NS.HTML); | |
else if (tn === $.FRAME) | |
p._appendElement(token, NS.HTML); | |
else if (tn === $.NOFRAMES) | |
startTagInHead(p, token); | |
} | |
function endTagInFrameset(p, token) { | |
if (token.tagName === $.FRAMESET && !p.openElements.isRootHtmlElementCurrent()) { | |
p.openElements.pop(); | |
if (!p.fragmentContext && p.openElements.currentTagName !== $.FRAMESET) | |
p.insertionMode = AFTER_FRAMESET_MODE; | |
} | |
} | |
//12.2.5.4.20 The "after frameset" insertion mode | |
//------------------------------------------------------------------ | |
function startTagAfterFrameset(p, token) { | |
var tn = token.tagName; | |
if (tn === $.HTML) | |
startTagInBody(p, token); | |
else if (tn === $.NOFRAMES) | |
startTagInHead(p, token); | |
} | |
function endTagAfterFrameset(p, token) { | |
if (token.tagName === $.HTML) | |
p.insertionMode = AFTER_AFTER_FRAMESET_MODE; | |
} | |
//12.2.5.4.21 The "after after body" insertion mode | |
//------------------------------------------------------------------ | |
function startTagAfterAfterBody(p, token) { | |
if (token.tagName === $.HTML) | |
startTagInBody(p, token); | |
else | |
tokenAfterAfterBody(p, token); | |
} | |
function tokenAfterAfterBody(p, token) { | |
p.insertionMode = IN_BODY_MODE; | |
p._processToken(token); | |
} | |
//12.2.5.4.22 The "after after frameset" insertion mode | |
//------------------------------------------------------------------ | |
function startTagAfterAfterFrameset(p, token) { | |
var tn = token.tagName; | |
if (tn === $.HTML) | |
startTagInBody(p, token); | |
else if (tn === $.NOFRAMES) | |
startTagInHead(p, token); | |
} | |
//12.2.5.5 The rules for parsing tokens in foreign content | |
//------------------------------------------------------------------ | |
function nullCharacterInForeignContent(p, token) { | |
token.chars = UNICODE.REPLACEMENT_CHARACTER; | |
p._insertCharacters(token); | |
} | |
function characterInForeignContent(p, token) { | |
p._insertCharacters(token); | |
p.framesetOk = false; | |
} | |
function startTagInForeignContent(p, token) { | |
if (ForeignContent.causesExit(token) && !p.fragmentContext) { | |
while (p.treeAdapter.getNamespaceURI(p.openElements.current) !== NS.HTML && | |
(!p._isMathMLTextIntegrationPoint(p.openElements.current)) && | |
(!p._isHtmlIntegrationPoint(p.openElements.current))) { | |
p.openElements.pop(); | |
} | |
p._processToken(token); | |
} | |
else { | |
var current = p._getAdjustedCurrentElement(), | |
currentNs = p.treeAdapter.getNamespaceURI(current); | |
if (currentNs === NS.MATHML) | |
ForeignContent.adjustTokenMathMLAttrs(token); | |
else if (currentNs === NS.SVG) { | |
ForeignContent.adjustTokenSVGTagName(token); | |
ForeignContent.adjustTokenSVGAttrs(token); | |
} | |
ForeignContent.adjustTokenXMLAttrs(token); | |
if (token.selfClosing) | |
p._appendElement(token, currentNs); | |
else | |
p._insertElement(token, currentNs); | |
} | |
} | |
function endTagInForeignContent(p, token) { | |
for (var i = p.openElements.stackTop; i > 0; i--) { | |
var element = p.openElements.items[i]; | |
if (p.treeAdapter.getNamespaceURI(element) === NS.HTML) { | |
p._processToken(token); | |
break; | |
} | |
if (p.treeAdapter.getTagName(element).toLowerCase() === token.tagName) { | |
p.openElements.popUntilElementPopped(element); | |
break; | |
} | |
} | |
} | |
/***/ }, | |
/* 64 */ | |
/*!**************************************************************!*\ | |
!*** ./~/jsdom/~/parse5/lib/simple_api/simple_api_parser.js ***! | |
\**************************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var Tokenizer = __webpack_require__(/*! ../tokenization/tokenizer */ 83), | |
TokenizerProxy = __webpack_require__(/*! ./tokenizer_proxy */ 82); | |
//Skipping handler | |
function skip() { | |
//NOTE: do nothing =) | |
} | |
//SimpleApiParser | |
var SimpleApiParser = module.exports = function (handlers) { | |
this.handlers = { | |
doctype: handlers.doctype || skip, | |
startTag: handlers.startTag || skip, | |
endTag: handlers.endTag || skip, | |
text: handlers.text || skip, | |
comment: handlers.comment || skip | |
}; | |
}; | |
//API | |
SimpleApiParser.prototype.parse = function (html) { | |
var token = null; | |
this._reset(html); | |
do { | |
token = this.tokenizerProxy.getNextToken(); | |
if (token.type === Tokenizer.CHARACTER_TOKEN || | |
token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN || | |
token.type === Tokenizer.NULL_CHARACTER_TOKEN) { | |
this.pendingText = (this.pendingText || '') + token.chars; | |
} | |
else { | |
this._emitPendingText(); | |
this._handleToken(token); | |
} | |
} while (token.type !== Tokenizer.EOF_TOKEN) | |
}; | |
//Internals | |
SimpleApiParser.prototype._handleToken = function (token) { | |
if (token.type === Tokenizer.START_TAG_TOKEN) | |
this.handlers.startTag(token.tagName, token.attrs, token.selfClosing); | |
else if (token.type === Tokenizer.END_TAG_TOKEN) | |
this.handlers.endTag(token.tagName); | |
else if (token.type === Tokenizer.COMMENT_TOKEN) | |
this.handlers.comment(token.data); | |
else if (token.type === Tokenizer.DOCTYPE_TOKEN) | |
this.handlers.doctype(token.name, token.publicId, token.systemId); | |
}; | |
SimpleApiParser.prototype._reset = function (html) { | |
this.tokenizerProxy = new TokenizerProxy(html); | |
this.pendingText = null; | |
}; | |
SimpleApiParser.prototype._emitPendingText = function () { | |
if (this.pendingText !== null) { | |
this.handlers.text(this.pendingText); | |
this.pendingText = null; | |
} | |
}; | |
/***/ }, | |
/* 65 */ | |
/*!********************************************************************!*\ | |
!*** ./~/jsdom/~/parse5/lib/tree_serialization/tree_serializer.js ***! | |
\********************************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var DefaultTreeAdapter = __webpack_require__(/*! ../tree_adapters/default */ 66), | |
HTML = __webpack_require__(/*! ../common/html */ 86); | |
//Aliases | |
var $ = HTML.TAG_NAMES, | |
NS = HTML.NAMESPACES; | |
//Escaping regexes | |
var AMP_REGEX = /&/g, | |
NBSP_REGEX = /\u00a0/g, | |
DOUBLE_QUOTE_REGEX = /"/g, | |
LT_REGEX = /</g, | |
GT_REGEX = />/g; | |
//Escape string | |
function escapeString(str, attrMode) { | |
str = str | |
.replace(AMP_REGEX, '&') | |
.replace(NBSP_REGEX, ' '); | |
if (attrMode) | |
str = str.replace(DOUBLE_QUOTE_REGEX, '"'); | |
else { | |
str = str | |
.replace(LT_REGEX, '<') | |
.replace(GT_REGEX, '>'); | |
} | |
return str; | |
} | |
//Enquote doctype ID | |
function enquoteDoctypeId(id) { | |
var quote = id.indexOf('"') !== -1 ? '\'' : '"'; | |
return quote + id + quote; | |
} | |
//TreeSerializer | |
var TreeSerializer = module.exports = function (treeAdapter) { | |
this.treeAdapter = treeAdapter || DefaultTreeAdapter; | |
}; | |
//API | |
TreeSerializer.prototype.serialize = function (node) { | |
this.html = ''; | |
this._serializeChildNodes(node); | |
return this.html; | |
}; | |
//Internals | |
TreeSerializer.prototype._serializeChildNodes = function (parentNode) { | |
var childNodes = this.treeAdapter.getChildNodes(parentNode); | |
if (childNodes) { | |
for (var i = 0, cnLength = childNodes.length; i < cnLength; i++) { | |
var currentNode = childNodes[i]; | |
if (this.treeAdapter.isElementNode(currentNode)) | |
this._serializeElement(currentNode); | |
else if (this.treeAdapter.isTextNode(currentNode)) | |
this._serializeTextNode(currentNode); | |
else if (this.treeAdapter.isCommentNode(currentNode)) | |
this._serializeCommentNode(currentNode); | |
else if (this.treeAdapter.isDocumentTypeNode(currentNode)) | |
this._serializeDocumentTypeNode(currentNode); | |
} | |
} | |
}; | |
TreeSerializer.prototype._serializeElement = function (node) { | |
var tn = this.treeAdapter.getTagName(node), | |
ns = this.treeAdapter.getNamespaceURI(node), | |
qualifiedTn = (ns === NS.HTML || ns === NS.SVG || ns === NS.MATHML) ? tn : (ns + ':' + tn); | |
this.html += '<' + qualifiedTn; | |
this._serializeAttributes(node); | |
this.html += '>'; | |
if (tn !== $.AREA && tn !== $.BASE && tn !== $.BASEFONT && tn !== $.BGSOUND && tn !== $.BR && tn !== $.BR && | |
tn !== $.COL && tn !== $.EMBED && tn !== $.FRAME && tn !== $.HR && tn !== $.IMG && tn !== $.INPUT && | |
tn !== $.KEYGEN && tn !== $.LINK && tn !== $.MENUITEM && tn !== $.META && tn !== $.PARAM && tn !== $.SOURCE && | |
tn !== $.TRACK && tn !== $.WBR) { | |
if (tn === $.PRE || tn === $.TEXTAREA || tn === $.LISTING) { | |
var firstChild = this.treeAdapter.getFirstChild(node); | |
if (firstChild && this.treeAdapter.isTextNode(firstChild)) { | |
var content = this.treeAdapter.getTextNodeContent(firstChild); | |
if (content[0] === '\n') | |
this.html += '\n'; | |
} | |
} | |
this._serializeChildNodes(node); | |
this.html += '</' + qualifiedTn + '>'; | |
} | |
}; | |
TreeSerializer.prototype._serializeAttributes = function (node) { | |
var attrs = this.treeAdapter.getAttrList(node); | |
for (var i = 0, attrsLength = attrs.length; i < attrsLength; i++) { | |
var attr = attrs[i]; | |
this.html += ' '; | |
if (!attr.namespace) | |
this.html += attr.name; | |
else if (attr.namespace === NS.XML) | |
this.html += 'xml:' + attr.name; | |
else if (attr.namespace === NS.XMLNS) { | |
if (attr.name !== 'xmlns') | |
this.html += 'xmlns:'; | |
this.html += attr.name; | |
} | |
else if (attr.namespace === NS.XLINK) | |
this.html += 'xlink:' + attr.name; | |
else | |
this.html += attr.namespace + ':' + attr.name; | |
this.html += '="' + escapeString(attr.value, true) + '"'; | |
} | |
}; | |
TreeSerializer.prototype._serializeTextNode = function (node) { | |
var parent = this.treeAdapter.getParentNode(node), | |
parentTn = parent && this.treeAdapter.getTagName(parent), | |
content = this.treeAdapter.getTextNodeContent(node); | |
if (parentTn === $.STYLE || parentTn === $.SCRIPT || parentTn === $.XMP || parentTn === $.IFRAME || | |
parentTn === $.NOEMBED || parentTn === $.NOFRAMES || parentTn === $.PLAINTEXT || parentTn === $.NOSCRIPT) { | |
this.html += content; | |
} | |
else | |
this.html += escapeString(content, false); | |
}; | |
TreeSerializer.prototype._serializeCommentNode = function (node) { | |
this.html += '<!--' + this.treeAdapter.getCommentNodeContent(node) + '-->'; | |
}; | |
TreeSerializer.prototype._serializeDocumentTypeNode = function (node) { | |
var name = this.treeAdapter.getDocumentTypeNodeName(node), | |
publicId = this.treeAdapter.getDocumentTypeNodePublicId(node), | |
systemId = this.treeAdapter.getDocumentTypeNodeSystemId(node); | |
this.html += '<!DOCTYPE ' + name; | |
if (publicId !== null) | |
this.html += ' PUBLIC ' + enquoteDoctypeId(publicId); | |
else if (systemId !== null) | |
this.html += ' SYSTEM'; | |
if (systemId !== null) | |
this.html += ' ' + enquoteDoctypeId(systemId); | |
this.html += '>'; | |
}; | |
/***/ }, | |
/* 66 */ | |
/*!*******************************************************!*\ | |
!*** ./~/jsdom/~/parse5/lib/tree_adapters/default.js ***! | |
\*******************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//Node construction | |
exports.createDocument = function () { | |
return { | |
nodeName: '#document', | |
quirksMode: false, | |
childNodes: [] | |
}; | |
}; | |
exports.createDocumentFragment = function () { | |
return { | |
nodeName: '#document-fragment', | |
quirksMode: false, | |
childNodes: [] | |
}; | |
}; | |
exports.createElement = function (tagName, namespaceURI, attrs) { | |
return { | |
nodeName: tagName, | |
tagName: tagName, | |
attrs: attrs, | |
namespaceURI: namespaceURI, | |
childNodes: [], | |
parentNode: null | |
}; | |
}; | |
exports.createCommentNode = function (data) { | |
return { | |
nodeName: '#comment', | |
data: data, | |
parentNode: null | |
}; | |
}; | |
var createTextNode = function (value) { | |
return { | |
nodeName: '#text', | |
value: value, | |
parentNode: null | |
} | |
}; | |
//Tree mutation | |
exports.setDocumentType = function (document, name, publicId, systemId) { | |
var doctypeNode = null; | |
for (var i = 0; i < document.childNodes.length; i++) { | |
if (document.childNodes[i].nodeName === '#documentType') { | |
doctypeNode = document.childNodes[i]; | |
break; | |
} | |
} | |
if (doctypeNode) { | |
doctypeNode.name = name; | |
doctypeNode.publicId = publicId; | |
doctypeNode.systemId = systemId; | |
} | |
else { | |
appendChild(document, { | |
nodeName: '#documentType', | |
name: name, | |
publicId: publicId, | |
systemId: systemId | |
}); | |
} | |
}; | |
exports.setQuirksMode = function (document) { | |
document.quirksMode = true; | |
}; | |
exports.isQuirksMode = function (document) { | |
return document.quirksMode; | |
}; | |
var appendChild = exports.appendChild = function (parentNode, newNode) { | |
parentNode.childNodes.push(newNode); | |
newNode.parentNode = parentNode; | |
}; | |
var insertBefore = exports.insertBefore = function (parentNode, newNode, referenceNode) { | |
var insertionIdx = parentNode.childNodes.indexOf(referenceNode); | |
parentNode.childNodes.splice(insertionIdx, 0, newNode); | |
newNode.parentNode = parentNode; | |
}; | |
exports.detachNode = function (node) { | |
if (node.parentNode) { | |
var idx = node.parentNode.childNodes.indexOf(node); | |
node.parentNode.childNodes.splice(idx, 1); | |
node.parentNode = null; | |
} | |
}; | |
exports.insertText = function (parentNode, text) { | |
if (parentNode.childNodes.length) { | |
var prevNode = parentNode.childNodes[parentNode.childNodes.length - 1]; | |
if (prevNode.nodeName === '#text') { | |
prevNode.value += text; | |
return; | |
} | |
} | |
appendChild(parentNode, createTextNode(text)); | |
}; | |
exports.insertTextBefore = function (parentNode, text, referenceNode) { | |
var prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1]; | |
if (prevNode && prevNode.nodeName === '#text') | |
prevNode.value += text; | |
else | |
insertBefore(parentNode, createTextNode(text), referenceNode); | |
}; | |
exports.adoptAttributes = function (recipientNode, attrs) { | |
var recipientAttrsMap = []; | |
for (var i = 0; i < recipientNode.attrs.length; i++) | |
recipientAttrsMap.push(recipientNode.attrs[i].name); | |
for (var j = 0; j < attrs.length; j++) { | |
if (recipientAttrsMap.indexOf(attrs[j].name) === -1) | |
recipientNode.attrs.push(attrs[j]); | |
} | |
}; | |
//Tree traversing | |
exports.getFirstChild = function (node) { | |
return node.childNodes[0]; | |
}; | |
exports.getChildNodes = function (node) { | |
return node.childNodes; | |
}; | |
exports.getParentNode = function (node) { | |
return node.parentNode; | |
}; | |
exports.getAttrList = function (node) { | |
return node.attrs; | |
}; | |
//Node data | |
exports.getTagName = function (element) { | |
return element.tagName; | |
}; | |
exports.getNamespaceURI = function (element) { | |
return element.namespaceURI; | |
}; | |
exports.getTextNodeContent = function (textNode) { | |
return textNode.value; | |
}; | |
exports.getCommentNodeContent = function (commentNode) { | |
return commentNode.data; | |
}; | |
exports.getDocumentTypeNodeName = function (doctypeNode) { | |
return doctypeNode.name; | |
}; | |
exports.getDocumentTypeNodePublicId = function (doctypeNode) { | |
return doctypeNode.publicId; | |
}; | |
exports.getDocumentTypeNodeSystemId = function (doctypeNode) { | |
return doctypeNode.systemId; | |
}; | |
//Node types | |
exports.isTextNode = function (node) { | |
return node.nodeName === '#text'; | |
}; | |
exports.isCommentNode = function (node) { | |
return node.nodeName === '#comment'; | |
}; | |
exports.isDocumentTypeNode = function (node) { | |
return node.nodeName === '#documentType'; | |
}; | |
exports.isElementNode = function (node) { | |
return !!node.tagName; | |
}; | |
/***/ }, | |
/* 67 */ | |
/*!***********************************************************!*\ | |
!*** ./~/jsdom/~/parse5/lib/tree_adapters/htmlparser2.js ***! | |
\***********************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//Node construction | |
exports.createDocument = | |
exports.createDocumentFragment = function () { | |
return { | |
type: 'root', | |
name: 'root', | |
parent: null, | |
prev: null, | |
next: null, | |
children: [] | |
}; | |
}; | |
exports.createElement = function (tagName, namespaceURI, attrs) { | |
var attribs = {}, | |
attribsNamespace = {}, | |
attribsPrefix = {}; | |
for (var i = 0; i < attrs.length; i++) { | |
var attrName = attrs[i].name; | |
attribs[attrName] = attrs[i].value; | |
attribsNamespace[attrName] = attrs[i].namespace; | |
attribsPrefix[attrName] = attrs[i].prefix; | |
} | |
return { | |
type: tagName === 'script' || tagName === 'style' ? tagName : 'tag', | |
name: tagName, | |
namespace: namespaceURI, | |
attribs: attribs, | |
'x-attribsNamespace': attribsNamespace, | |
'x-attribsPrefix': attribsPrefix, | |
children: [], | |
parent: null, | |
prev: null, | |
next: null | |
}; | |
}; | |
exports.createCommentNode = function (data) { | |
return { | |
type: 'comment', | |
data: data, | |
parent: null, | |
prev: null, | |
next: null | |
}; | |
}; | |
var createTextNode = function (value) { | |
return { | |
type: 'text', | |
data: value, | |
parent: null, | |
prev: null, | |
next: null | |
} | |
}; | |
//Tree mutation | |
exports.setDocumentType = function (document, name, publicId, systemId) { | |
var data = '!DOCTYPE'; | |
if (name) | |
data += ' ' + name; | |
if (publicId) | |
data += ' PUBLIC "' + publicId + '"'; | |
if (systemId) | |
data += ' "' + systemId + '"'; | |
var doctypeNode = null; | |
for (var i = 0; i < document.children.length; i++) { | |
if (document.children[i].type === 'directive' && document.children[i].name === '!doctype') { | |
doctypeNode = document.children[i]; | |
break; | |
} | |
} | |
if (doctypeNode) { | |
doctypeNode.data = data; | |
doctypeNode['x-name'] = name; | |
doctypeNode['x-publicId'] = publicId; | |
doctypeNode['x-systemId'] = systemId; | |
} | |
else { | |
appendChild(document, { | |
type: 'directive', | |
name: '!doctype', | |
data: data, | |
'x-name': name, | |
'x-publicId': publicId, | |
'x-systemId': systemId | |
}); | |
} | |
}; | |
exports.setQuirksMode = function (document) { | |
document.quirksMode = true; | |
}; | |
exports.isQuirksMode = function (document) { | |
return document.quirksMode; | |
}; | |
var appendChild = exports.appendChild = function (parentNode, newNode) { | |
var prev = parentNode.children[parentNode.children.length - 1]; | |
if (prev) { | |
prev.next = newNode; | |
newNode.prev = prev; | |
} | |
parentNode.children.push(newNode); | |
newNode.parent = parentNode; | |
}; | |
var insertBefore = exports.insertBefore = function (parentNode, newNode, referenceNode) { | |
var insertionIdx = parentNode.children.indexOf(referenceNode), | |
prev = referenceNode.prev; | |
if (prev) { | |
prev.next = newNode; | |
newNode.prev = prev; | |
} | |
referenceNode.prev = newNode; | |
newNode.next = referenceNode; | |
parentNode.children.splice(insertionIdx, 0, newNode); | |
newNode.parent = parentNode; | |
}; | |
exports.detachNode = function (node) { | |
if (node.parent) { | |
var idx = node.parent.children.indexOf(node), | |
prev = node.prev, | |
next = node.next; | |
node.prev = null; | |
node.next = null; | |
if (prev) | |
prev.next = next; | |
if (next) | |
next.prev = prev; | |
node.parent.children.splice(idx, 1); | |
node.parent = null; | |
} | |
}; | |
exports.insertText = function (parentNode, text) { | |
var lastChild = parentNode.children[parentNode.children.length - 1]; | |
if (lastChild && lastChild.type === 'text') | |
lastChild.data += text; | |
else | |
appendChild(parentNode, createTextNode(text)); | |
}; | |
exports.insertTextBefore = function (parentNode, text, referenceNode) { | |
var prevNode = parentNode.children[parentNode.children.indexOf(referenceNode) - 1]; | |
if (prevNode && prevNode.type === 'text') | |
prevNode.data += text; | |
else | |
insertBefore(parentNode, createTextNode(text), referenceNode); | |
}; | |
exports.adoptAttributes = function (recipientNode, attrs) { | |
for (var i = 0; i < attrs.length; i++) { | |
var attrName = attrs[i].name; | |
if (typeof recipientNode.attribs[attrName] === 'undefined') { | |
recipientNode.attribs[attrName] = attrs[i].value; | |
recipientNode['x-attribsNamespace'][attrName] = attrs[i].namespace; | |
recipientNode['x-attribsPrefix'][attrName] = attrs[i].prefix; | |
} | |
} | |
}; | |
//Tree traversing | |
exports.getFirstChild = function (node) { | |
return node.children[0]; | |
}; | |
exports.getChildNodes = function (node) { | |
return node.children; | |
}; | |
exports.getParentNode = function (node) { | |
return node.parent; | |
}; | |
exports.getAttrList = function (node) { | |
var attrList = []; | |
for (var name in node.attribs) { | |
if (node.attribs.hasOwnProperty(name)) { | |
attrList.push({ | |
name: name, | |
value: node.attribs[name], | |
namespace: node['x-attribsNamespace'][name], | |
prefix: node['x-attribsPrefix'][name] | |
}); | |
} | |
} | |
return attrList; | |
}; | |
//Node data | |
exports.getTagName = function (element) { | |
return element.name; | |
}; | |
exports.getNamespaceURI = function (element) { | |
return element.namespace; | |
}; | |
exports.getTextNodeContent = function (textNode) { | |
return textNode.data; | |
}; | |
exports.getCommentNodeContent = function (commentNode) { | |
return commentNode.data; | |
}; | |
exports.getDocumentTypeNodeName = function (doctypeNode) { | |
return doctypeNode['x-name']; | |
}; | |
exports.getDocumentTypeNodePublicId = function (doctypeNode) { | |
return doctypeNode['x-publicId']; | |
}; | |
exports.getDocumentTypeNodeSystemId = function (doctypeNode) { | |
return doctypeNode['x-systemId']; | |
}; | |
//Node types | |
exports.isTextNode = function (node) { | |
return node.type === 'text'; | |
}; | |
exports.isCommentNode = function (node) { | |
return node.type === 'comment'; | |
}; | |
exports.isDocumentTypeNode = function (node) { | |
return node.type === 'directive' && node.name === '!doctype'; | |
}; | |
exports.isElementNode = function (node) { | |
return !!node.attribs; | |
}; | |
/***/ }, | |
/* 68 */ | |
/*!*****************************************************************!*\ | |
!*** (webpack)/~/node-libs-browser/~/querystring-es3/decode.js ***! | |
\*****************************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
// Copyright Joyent, Inc. and other Node contributors. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a | |
// copy of this software and associated documentation files (the | |
// "Software"), to deal in the Software without restriction, including | |
// without limitation the rights to use, copy, modify, merge, publish, | |
// distribute, sublicense, and/or sell copies of the Software, and to permit | |
// persons to whom the Software is furnished to do so, subject to the | |
// following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included | |
// in all copies or substantial portions of the Software. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | |
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | |
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | |
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | |
// USE OR OTHER DEALINGS IN THE SOFTWARE. | |
'use strict'; | |
// If obj.hasOwnProperty has been overridden, then calling | |
// obj.hasOwnProperty(prop) will break. | |
// See: https://github.com/joyent/node/issues/1707 | |
function hasOwnProperty(obj, prop) { | |
return Object.prototype.hasOwnProperty.call(obj, prop); | |
} | |
module.exports = function(qs, sep, eq, options) { | |
sep = sep || '&'; | |
eq = eq || '='; | |
var obj = {}; | |
if (typeof qs !== 'string' || qs.length === 0) { | |
return obj; | |
} | |
var regexp = /\+/g; | |
qs = qs.split(sep); | |
var maxKeys = 1000; | |
if (options && typeof options.maxKeys === 'number') { | |
maxKeys = options.maxKeys; | |
} | |
var len = qs.length; | |
// maxKeys <= 0 means that we should not limit keys count | |
if (maxKeys > 0 && len > maxKeys) { | |
len = maxKeys; | |
} | |
for (var i = 0; i < len; ++i) { | |
var x = qs[i].replace(regexp, '%20'), | |
idx = x.indexOf(eq), | |
kstr, vstr, k, v; | |
if (idx >= 0) { | |
kstr = x.substr(0, idx); | |
vstr = x.substr(idx + 1); | |
} else { | |
kstr = x; | |
vstr = ''; | |
} | |
k = decodeURIComponent(kstr); | |
v = decodeURIComponent(vstr); | |
if (!hasOwnProperty(obj, k)) { | |
obj[k] = v; | |
} else if (isArray(obj[k])) { | |
obj[k].push(v); | |
} else { | |
obj[k] = [obj[k], v]; | |
} | |
} | |
return obj; | |
}; | |
var isArray = Array.isArray || function (xs) { | |
return Object.prototype.toString.call(xs) === '[object Array]'; | |
}; | |
/***/ }, | |
/* 69 */ | |
/*!*****************************************************************!*\ | |
!*** (webpack)/~/node-libs-browser/~/querystring-es3/encode.js ***! | |
\*****************************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
// Copyright Joyent, Inc. and other Node contributors. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a | |
// copy of this software and associated documentation files (the | |
// "Software"), to deal in the Software without restriction, including | |
// without limitation the rights to use, copy, modify, merge, publish, | |
// distribute, sublicense, and/or sell copies of the Software, and to permit | |
// persons to whom the Software is furnished to do so, subject to the | |
// following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included | |
// in all copies or substantial portions of the Software. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | |
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | |
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | |
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | |
// USE OR OTHER DEALINGS IN THE SOFTWARE. | |
'use strict'; | |
var stringifyPrimitive = function(v) { | |
switch (typeof v) { | |
case 'string': | |
return v; | |
case 'boolean': | |
return v ? 'true' : 'false'; | |
case 'number': | |
return isFinite(v) ? v : ''; | |
default: | |
return ''; | |
} | |
}; | |
module.exports = function(obj, sep, eq, name) { | |
sep = sep || '&'; | |
eq = eq || '='; | |
if (obj === null) { | |
obj = undefined; | |
} | |
if (typeof obj === 'object') { | |
return map(objectKeys(obj), function(k) { | |
var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; | |
if (isArray(obj[k])) { | |
return map(obj[k], function(v) { | |
return ks + encodeURIComponent(stringifyPrimitive(v)); | |
}).join(sep); | |
} else { | |
return ks + encodeURIComponent(stringifyPrimitive(obj[k])); | |
} | |
}).join(sep); | |
} | |
if (!name) return ''; | |
return encodeURIComponent(stringifyPrimitive(name)) + eq + | |
encodeURIComponent(stringifyPrimitive(obj)); | |
}; | |
var isArray = Array.isArray || function (xs) { | |
return Object.prototype.toString.call(xs) === '[object Array]'; | |
}; | |
function map (xs, f) { | |
if (xs.map) return xs.map(f); | |
var res = []; | |
for (var i = 0; i < xs.length; i++) { | |
res.push(f(xs[i], i)); | |
} | |
return res; | |
} | |
var objectKeys = Object.keys || function (obj) { | |
var res = []; | |
for (var key in obj) { | |
if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); | |
} | |
return res; | |
}; | |
/***/ }, | |
/* 70 */ | |
/*!*************************************************************!*\ | |
!*** (webpack)/~/node-libs-browser/~/assert/~/util/util.js ***! | |
\*************************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a | |
// copy of this software and associated documentation files (the | |
// "Software"), to deal in the Software without restriction, including | |
// without limitation the rights to use, copy, modify, merge, publish, | |
// distribute, sublicense, and/or sell copies of the Software, and to permit | |
// persons to whom the Software is furnished to do so, subject to the | |
// following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included | |
// in all copies or substantial portions of the Software. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | |
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | |
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | |
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | |
// USE OR OTHER DEALINGS IN THE SOFTWARE. | |
var formatRegExp = /%[sdj%]/g; | |
exports.format = function(f) { | |
if (!isString(f)) { | |
var objects = []; | |
for (var i = 0; i < arguments.length; i++) { | |
objects.push(inspect(arguments[i])); | |
} | |
return objects.join(' '); | |
} | |
var i = 1; | |
var args = arguments; | |
var len = args.length; | |
var str = String(f).replace(formatRegExp, function(x) { | |
if (x === '%%') return '%'; | |
if (i >= len) return x; | |
switch (x) { | |
case '%s': return String(args[i++]); | |
case '%d': return Number(args[i++]); | |
case '%j': | |
try { | |
return JSON.stringify(args[i++]); | |
} catch (_) { | |
return '[Circular]'; | |
} | |
default: | |
return x; | |
} | |
}); | |
for (var x = args[i]; i < len; x = args[++i]) { | |
if (isNull(x) || !isObject(x)) { | |
str += ' ' + x; | |
} else { | |
str += ' ' + inspect(x); | |
} | |
} | |
return str; | |
}; | |
// Mark that a method should not be used. | |
// Returns a modified function which warns once by default. | |
// If --no-deprecation is set, then it is a no-op. | |
exports.deprecate = function(fn, msg) { | |
// Allow for deprecating things in the process of starting up. | |
if (isUndefined(global.process)) { | |
return function() { | |
return exports.deprecate(fn, msg).apply(this, arguments); | |
}; | |
} | |
if (process.noDeprecation === true) { | |
return fn; | |
} | |
var warned = false; | |
function deprecated() { | |
if (!warned) { | |
if (process.throwDeprecation) { | |
throw new Error(msg); | |
} else if (process.traceDeprecation) { | |
console.trace(msg); | |
} else { | |
console.error(msg); | |
} | |
warned = true; | |
} | |
return fn.apply(this, arguments); | |
} | |
return deprecated; | |
}; | |
var debugs = {}; | |
var debugEnviron; | |
exports.debuglog = function(set) { | |
if (isUndefined(debugEnviron)) | |
debugEnviron = process.env.NODE_DEBUG || ''; | |
set = set.toUpperCase(); | |
if (!debugs[set]) { | |
if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { | |
var pid = process.pid; | |
debugs[set] = function() { | |
var msg = exports.format.apply(exports, arguments); | |
console.error('%s %d: %s', set, pid, msg); | |
}; | |
} else { | |
debugs[set] = function() {}; | |
} | |
} | |
return debugs[set]; | |
}; | |
/** | |
* Echos the value of a value. Trys to print the value out | |
* in the best way possible given the different types. | |
* | |
* @param {Object} obj The object to print out. | |
* @param {Object} opts Optional options object that alters the output. | |
*/ | |
/* legacy: obj, showHidden, depth, colors*/ | |
function inspect(obj, opts) { | |
// default options | |
var ctx = { | |
seen: [], | |
stylize: stylizeNoColor | |
}; | |
// legacy... | |
if (arguments.length >= 3) ctx.depth = arguments[2]; | |
if (arguments.length >= 4) ctx.colors = arguments[3]; | |
if (isBoolean(opts)) { | |
// legacy... | |
ctx.showHidden = opts; | |
} else if (opts) { | |
// got an "options" object | |
exports._extend(ctx, opts); | |
} | |
// set default options | |
if (isUndefined(ctx.showHidden)) ctx.showHidden = false; | |
if (isUndefined(ctx.depth)) ctx.depth = 2; | |
if (isUndefined(ctx.colors)) ctx.colors = false; | |
if (isUndefined(ctx.customInspect)) ctx.customInspect = true; | |
if (ctx.colors) ctx.stylize = stylizeWithColor; | |
return formatValue(ctx, obj, ctx.depth); | |
} | |
exports.inspect = inspect; | |
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics | |
inspect.colors = { | |
'bold' : [1, 22], | |
'italic' : [3, 23], | |
'underline' : [4, 24], | |
'inverse' : [7, 27], | |
'white' : [37, 39], | |
'grey' : [90, 39], | |
'black' : [30, 39], | |
'blue' : [34, 39], | |
'cyan' : [36, 39], | |
'green' : [32, 39], | |
'magenta' : [35, 39], | |
'red' : [31, 39], | |
'yellow' : [33, 39] | |
}; | |
// Don't use 'blue' not visible on cmd.exe | |
inspect.styles = { | |
'special': 'cyan', | |
'number': 'yellow', | |
'boolean': 'yellow', | |
'undefined': 'grey', | |
'null': 'bold', | |
'string': 'green', | |
'date': 'magenta', | |
// "name": intentionally not styling | |
'regexp': 'red' | |
}; | |
function stylizeWithColor(str, styleType) { | |
var style = inspect.styles[styleType]; | |
if (style) { | |
return '\u001b[' + inspect.colors[style][0] + 'm' + str + | |
'\u001b[' + inspect.colors[style][1] + 'm'; | |
} else { | |
return str; | |
} | |
} | |
function stylizeNoColor(str, styleType) { | |
return str; | |
} | |
function arrayToHash(array) { | |
var hash = {}; | |
array.forEach(function(val, idx) { | |
hash[val] = true; | |
}); | |
return hash; | |
} | |
function formatValue(ctx, value, recurseTimes) { | |
// Provide a hook for user-specified inspect functions. | |
// Check that value is an object with an inspect function on it | |
if (ctx.customInspect && | |
value && | |
isFunction(value.inspect) && | |
// Filter out the util module, it's inspect function is special | |
value.inspect !== exports.inspect && | |
// Also filter out any prototype objects using the circular check. | |
!(value.constructor && value.constructor.prototype === value)) { | |
var ret = value.inspect(recurseTimes, ctx); | |
if (!isString(ret)) { | |
ret = formatValue(ctx, ret, recurseTimes); | |
} | |
return ret; | |
} | |
// Primitive types cannot have properties | |
var primitive = formatPrimitive(ctx, value); | |
if (primitive) { | |
return primitive; | |
} | |
// Look up the keys of the object. | |
var keys = Object.keys(value); | |
var visibleKeys = arrayToHash(keys); | |
if (ctx.showHidden) { | |
keys = Object.getOwnPropertyNames(value); | |
} | |
// IE doesn't make error fields non-enumerable | |
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx | |
if (isError(value) | |
&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { | |
return formatError(value); | |
} | |
// Some type of object without properties can be shortcutted. | |
if (keys.length === 0) { | |
if (isFunction(value)) { | |
var name = value.name ? ': ' + value.name : ''; | |
return ctx.stylize('[Function' + name + ']', 'special'); | |
} | |
if (isRegExp(value)) { | |
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); | |
} | |
if (isDate(value)) { | |
return ctx.stylize(Date.prototype.toString.call(value), 'date'); | |
} | |
if (isError(value)) { | |
return formatError(value); | |
} | |
} | |
var base = '', array = false, braces = ['{', '}']; | |
// Make Array say that they are Array | |
if (isArray(value)) { | |
array = true; | |
braces = ['[', ']']; | |
} | |
// Make functions say that they are functions | |
if (isFunction(value)) { | |
var n = value.name ? ': ' + value.name : ''; | |
base = ' [Function' + n + ']'; | |
} | |
// Make RegExps say that they are RegExps | |
if (isRegExp(value)) { | |
base = ' ' + RegExp.prototype.toString.call(value); | |
} | |
// Make dates with properties first say the date | |
if (isDate(value)) { | |
base = ' ' + Date.prototype.toUTCString.call(value); | |
} | |
// Make error with message first say the error | |
if (isError(value)) { | |
base = ' ' + formatError(value); | |
} | |
if (keys.length === 0 && (!array || value.length == 0)) { | |
return braces[0] + base + braces[1]; | |
} | |
if (recurseTimes < 0) { | |
if (isRegExp(value)) { | |
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); | |
} else { | |
return ctx.stylize('[Object]', 'special'); | |
} | |
} | |
ctx.seen.push(value); | |
var output; | |
if (array) { | |
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); | |
} else { | |
output = keys.map(function(key) { | |
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); | |
}); | |
} | |
ctx.seen.pop(); | |
return reduceToSingleString(output, base, braces); | |
} | |
function formatPrimitive(ctx, value) { | |
if (isUndefined(value)) | |
return ctx.stylize('undefined', 'undefined'); | |
if (isString(value)) { | |
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') | |
.replace(/'/g, "\\'") | |
.replace(/\\"/g, '"') + '\''; | |
return ctx.stylize(simple, 'string'); | |
} | |
if (isNumber(value)) | |
return ctx.stylize('' + value, 'number'); | |
if (isBoolean(value)) | |
return ctx.stylize('' + value, 'boolean'); | |
// For some reason typeof null is "object", so special case here. | |
if (isNull(value)) | |
return ctx.stylize('null', 'null'); | |
} | |
function formatError(value) { | |
return '[' + Error.prototype.toString.call(value) + ']'; | |
} | |
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { | |
var output = []; | |
for (var i = 0, l = value.length; i < l; ++i) { | |
if (hasOwnProperty(value, String(i))) { | |
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, | |
String(i), true)); | |
} else { | |
output.push(''); | |
} | |
} | |
keys.forEach(function(key) { | |
if (!key.match(/^\d+$/)) { | |
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, | |
key, true)); | |
} | |
}); | |
return output; | |
} | |
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { | |
var name, str, desc; | |
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; | |
if (desc.get) { | |
if (desc.set) { | |
str = ctx.stylize('[Getter/Setter]', 'special'); | |
} else { | |
str = ctx.stylize('[Getter]', 'special'); | |
} | |
} else { | |
if (desc.set) { | |
str = ctx.stylize('[Setter]', 'special'); | |
} | |
} | |
if (!hasOwnProperty(visibleKeys, key)) { | |
name = '[' + key + ']'; | |
} | |
if (!str) { | |
if (ctx.seen.indexOf(desc.value) < 0) { | |
if (isNull(recurseTimes)) { | |
str = formatValue(ctx, desc.value, null); | |
} else { | |
str = formatValue(ctx, desc.value, recurseTimes - 1); | |
} | |
if (str.indexOf('\n') > -1) { | |
if (array) { | |
str = str.split('\n').map(function(line) { | |
return ' ' + line; | |
}).join('\n').substr(2); | |
} else { | |
str = '\n' + str.split('\n').map(function(line) { | |
return ' ' + line; | |
}).join('\n'); | |
} | |
} | |
} else { | |
str = ctx.stylize('[Circular]', 'special'); | |
} | |
} | |
if (isUndefined(name)) { | |
if (array && key.match(/^\d+$/)) { | |
return str; | |
} | |
name = JSON.stringify('' + key); | |
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { | |
name = name.substr(1, name.length - 2); | |
name = ctx.stylize(name, 'name'); | |
} else { | |
name = name.replace(/'/g, "\\'") | |
.replace(/\\"/g, '"') | |
.replace(/(^"|"$)/g, "'"); | |
name = ctx.stylize(name, 'string'); | |
} | |
} | |
return name + ': ' + str; | |
} | |
function reduceToSingleString(output, base, braces) { | |
var numLinesEst = 0; | |
var length = output.reduce(function(prev, cur) { | |
numLinesEst++; | |
if (cur.indexOf('\n') >= 0) numLinesEst++; | |
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; | |
}, 0); | |
if (length > 60) { | |
return braces[0] + | |
(base === '' ? '' : base + '\n ') + | |
' ' + | |
output.join(',\n ') + | |
' ' + | |
braces[1]; | |
} | |
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; | |
} | |
// NOTE: These type checking functions intentionally don't use `instanceof` | |
// because it is fragile and can be easily faked with `Object.create()`. | |
function isArray(ar) { | |
return Array.isArray(ar); | |
} | |
exports.isArray = isArray; | |
function isBoolean(arg) { | |
return typeof arg === 'boolean'; | |
} | |
exports.isBoolean = isBoolean; | |
function isNull(arg) { | |
return arg === null; | |
} | |
exports.isNull = isNull; | |
function isNullOrUndefined(arg) { | |
return arg == null; | |
} | |
exports.isNullOrUndefined = isNullOrUndefined; | |
function isNumber(arg) { | |
return typeof arg === 'number'; | |
} | |
exports.isNumber = isNumber; | |
function isString(arg) { | |
return typeof arg === 'string'; | |
} | |
exports.isString = isString; | |
function isSymbol(arg) { | |
return typeof arg === 'symbol'; | |
} | |
exports.isSymbol = isSymbol; | |
function isUndefined(arg) { | |
return arg === void 0; | |
} | |
exports.isUndefined = isUndefined; | |
function isRegExp(re) { | |
return isObject(re) && objectToString(re) === '[object RegExp]'; | |
} | |
exports.isRegExp = isRegExp; | |
function isObject(arg) { | |
return typeof arg === 'object' && arg !== null; | |
} | |
exports.isObject = isObject; | |
function isDate(d) { | |
return isObject(d) && objectToString(d) === '[object Date]'; | |
} | |
exports.isDate = isDate; | |
function isError(e) { | |
return isObject(e) && | |
(objectToString(e) === '[object Error]' || e instanceof Error); | |
} | |
exports.isError = isError; | |
function isFunction(arg) { | |
return typeof arg === 'function'; | |
} | |
exports.isFunction = isFunction; | |
function isPrimitive(arg) { | |
return arg === null || | |
typeof arg === 'boolean' || | |
typeof arg === 'number' || | |
typeof arg === 'string' || | |
typeof arg === 'symbol' || // ES6 symbol | |
typeof arg === 'undefined'; | |
} | |
exports.isPrimitive = isPrimitive; | |
exports.isBuffer = __webpack_require__(/*! ./support/isBuffer */ 91); | |
function objectToString(o) { | |
return Object.prototype.toString.call(o); | |
} | |
function pad(n) { | |
return n < 10 ? '0' + n.toString(10) : n.toString(10); | |
} | |
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', | |
'Oct', 'Nov', 'Dec']; | |
// 26 Feb 16:19:34 | |
function timestamp() { | |
var d = new Date(); | |
var time = [pad(d.getHours()), | |
pad(d.getMinutes()), | |
pad(d.getSeconds())].join(':'); | |
return [d.getDate(), months[d.getMonth()], time].join(' '); | |
} | |
// log is just a thin wrapper to console.log that prepends a timestamp | |
exports.log = function() { | |
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); | |
}; | |
/** | |
* Inherit the prototype methods from one constructor into another. | |
* | |
* The Function.prototype.inherits from lang.js rewritten as a standalone | |
* function (not on Function.prototype). NOTE: If this file is to be loaded | |
* during bootstrapping this function needs to be rewritten using some native | |
* functions as prototype setup using normal JavaScript does not work as | |
* expected during bootstrapping (see mirror.js in r114903). | |
* | |
* @param {function} ctor Constructor function which needs to inherit the | |
* prototype. | |
* @param {function} superCtor Constructor function to inherit prototype from. | |
*/ | |
exports.inherits = __webpack_require__(/*! inherits */ 98); | |
exports._extend = function(origin, add) { | |
// Don't do anything if add isn't an object | |
if (!add || !isObject(add)) return origin; | |
var keys = Object.keys(add); | |
var i = keys.length; | |
while (i--) { | |
origin[keys[i]] = add[keys[i]]; | |
} | |
return origin; | |
}; | |
function hasOwnProperty(obj, prop) { | |
return Object.prototype.hasOwnProperty.call(obj, prop); | |
} | |
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(/*! (webpack)/~/node-libs-browser/~/process/browser.js */ 13))) | |
/***/ }, | |
/* 71 */ | |
/*!*******************************************************!*\ | |
!*** (webpack)/~/node-libs-browser/~/buffer/index.js ***! | |
\*******************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(Buffer) {/*! | |
* The buffer module from node.js, for the browser. | |
* | |
* @author Feross Aboukhadijeh <[email protected]> <http://feross.org> | |
* @license MIT | |
*/ | |
var base64 = __webpack_require__(/*! base64-js */ 106) | |
var ieee754 = __webpack_require__(/*! ieee754 */ 96) | |
exports.Buffer = Buffer | |
exports.SlowBuffer = Buffer | |
exports.INSPECT_MAX_BYTES = 50 | |
Buffer.poolSize = 8192 | |
/** | |
* If `Buffer._useTypedArrays`: | |
* === true Use Uint8Array implementation (fastest) | |
* === false Use Object implementation (compatible down to IE6) | |
*/ | |
Buffer._useTypedArrays = (function () { | |
// Detect if browser supports Typed Arrays. Supported browsers are IE 10+, Firefox 4+, | |
// Chrome 7+, Safari 5.1+, Opera 11.6+, iOS 4.2+. If the browser does not support adding | |
// properties to `Uint8Array` instances, then that's the same as no `Uint8Array` support | |
// because we need to be able to add all the node Buffer API methods. This is an issue | |
// in Firefox 4-29. Now fixed: https://bugzilla.mozilla.org/show_bug.cgi?id=695438 | |
try { | |
var buf = new ArrayBuffer(0) | |
var arr = new Uint8Array(buf) | |
arr.foo = function () { return 42 } | |
return 42 === arr.foo() && | |
typeof arr.subarray === 'function' // Chrome 9-10 lack `subarray` | |
} catch (e) { | |
return false | |
} | |
})() | |
/** | |
* Class: Buffer | |
* ============= | |
* | |
* The Buffer constructor returns instances of `Uint8Array` that are augmented | |
* with function properties for all the node `Buffer` API functions. We use | |
* `Uint8Array` so that square bracket notation works as expected -- it returns | |
* a single octet. | |
* | |
* By augmenting the instances, we can avoid modifying the `Uint8Array` | |
* prototype. | |
*/ | |
function Buffer (subject, encoding, noZero) { | |
if (!(this instanceof Buffer)) | |
return new Buffer(subject, encoding, noZero) | |
var type = typeof subject | |
// Find the length | |
var length | |
if (type === 'number') | |
length = subject > 0 ? subject >>> 0 : 0 | |
else if (type === 'string') { | |
if (encoding === 'base64') | |
subject = base64clean(subject) | |
length = Buffer.byteLength(subject, encoding) | |
} else if (type === 'object' && subject !== null) { // assume object is array-like | |
if (subject.type === 'Buffer' && Array.isArray(subject.data)) | |
subject = subject.data | |
length = +subject.length > 0 ? Math.floor(+subject.length) : 0 | |
} else | |
throw new Error('First argument needs to be a number, array or string.') | |
var buf | |
if (Buffer._useTypedArrays) { | |
// Preferred: Return an augmented `Uint8Array` instance for best performance | |
buf = Buffer._augment(new Uint8Array(length)) | |
} else { | |
// Fallback: Return THIS instance of Buffer (created by `new`) | |
buf = this | |
buf.length = length | |
buf._isBuffer = true | |
} | |
var i | |
if (Buffer._useTypedArrays && typeof subject.byteLength === 'number') { | |
// Speed optimization -- use set if we're copying from a typed array | |
buf._set(subject) | |
} else if (isArrayish(subject)) { | |
// Treat array-ish objects as a byte array | |
if (Buffer.isBuffer(subject)) { | |
for (i = 0; i < length; i++) | |
buf[i] = subject.readUInt8(i) | |
} else { | |
for (i = 0; i < length; i++) | |
buf[i] = ((subject[i] % 256) + 256) % 256 | |
} | |
} else if (type === 'string') { | |
buf.write(subject, 0, encoding) | |
} else if (type === 'number' && !Buffer._useTypedArrays && !noZero) { | |
for (i = 0; i < length; i++) { | |
buf[i] = 0 | |
} | |
} | |
return buf | |
} | |
// STATIC METHODS | |
// ============== | |
Buffer.isEncoding = function (encoding) { | |
switch (String(encoding).toLowerCase()) { | |
case 'hex': | |
case 'utf8': | |
case 'utf-8': | |
case 'ascii': | |
case 'binary': | |
case 'base64': | |
case 'raw': | |
case 'ucs2': | |
case 'ucs-2': | |
case 'utf16le': | |
case 'utf-16le': | |
return true | |
default: | |
return false | |
} | |
} | |
Buffer.isBuffer = function (b) { | |
return !!(b != null && b._isBuffer) | |
} | |
Buffer.byteLength = function (str, encoding) { | |
var ret | |
str = str.toString() | |
switch (encoding || 'utf8') { | |
case 'hex': | |
ret = str.length / 2 | |
break | |
case 'utf8': | |
case 'utf-8': | |
ret = utf8ToBytes(str).length | |
break | |
case 'ascii': | |
case 'binary': | |
case 'raw': | |
ret = str.length | |
break | |
case 'base64': | |
ret = base64ToBytes(str).length | |
break | |
case 'ucs2': | |
case 'ucs-2': | |
case 'utf16le': | |
case 'utf-16le': | |
ret = str.length * 2 | |
break | |
default: | |
throw new Error('Unknown encoding') | |
} | |
return ret | |
} | |
Buffer.concat = function (list, totalLength) { | |
assert(isArray(list), 'Usage: Buffer.concat(list[, length])') | |
if (list.length === 0) { | |
return new Buffer(0) | |
} else if (list.length === 1) { | |
return list[0] | |
} | |
var i | |
if (totalLength === undefined) { | |
totalLength = 0 | |
for (i = 0; i < list.length; i++) { | |
totalLength += list[i].length | |
} | |
} | |
var buf = new Buffer(totalLength) | |
var pos = 0 | |
for (i = 0; i < list.length; i++) { | |
var item = list[i] | |
item.copy(buf, pos) | |
pos += item.length | |
} | |
return buf | |
} | |
Buffer.compare = function (a, b) { | |
assert(Buffer.isBuffer(a) && Buffer.isBuffer(b), 'Arguments must be Buffers') | |
var x = a.length | |
var y = b.length | |
for (var i = 0, len = Math.min(x, y); i < len && a[i] === b[i]; i++) {} | |
if (i !== len) { | |
x = a[i] | |
y = b[i] | |
} | |
if (x < y) { | |
return -1 | |
} | |
if (y < x) { | |
return 1 | |
} | |
return 0 | |
} | |
// BUFFER INSTANCE METHODS | |
// ======================= | |
function hexWrite (buf, string, offset, length) { | |
offset = Number(offset) || 0 | |
var remaining = buf.length - offset | |
if (!length) { | |
length = remaining | |
} else { | |
length = Number(length) | |
if (length > remaining) { | |
length = remaining | |
} | |
} | |
// must be an even number of digits | |
var strLen = string.length | |
assert(strLen % 2 === 0, 'Invalid hex string') | |
if (length > strLen / 2) { | |
length = strLen / 2 | |
} | |
for (var i = 0; i < length; i++) { | |
var byte = parseInt(string.substr(i * 2, 2), 16) | |
assert(!isNaN(byte), 'Invalid hex string') | |
buf[offset + i] = byte | |
} | |
return i | |
} | |
function utf8Write (buf, string, offset, length) { | |
var charsWritten = blitBuffer(utf8ToBytes(string), buf, offset, length) | |
return charsWritten | |
} | |
function asciiWrite (buf, string, offset, length) { | |
var charsWritten = blitBuffer(asciiToBytes(string), buf, offset, length) | |
return charsWritten | |
} | |
function binaryWrite (buf, string, offset, length) { | |
return asciiWrite(buf, string, offset, length) | |
} | |
function base64Write (buf, string, offset, length) { | |
var charsWritten = blitBuffer(base64ToBytes(string), buf, offset, length) | |
return charsWritten | |
} | |
function utf16leWrite (buf, string, offset, length) { | |
var charsWritten = blitBuffer(utf16leToBytes(string), buf, offset, length) | |
return charsWritten | |
} | |
Buffer.prototype.write = function (string, offset, length, encoding) { | |
// Support both (string, offset, length, encoding) | |
// and the legacy (string, encoding, offset, length) | |
if (isFinite(offset)) { | |
if (!isFinite(length)) { | |
encoding = length | |
length = undefined | |
} | |
} else { // legacy | |
var swap = encoding | |
encoding = offset | |
offset = length | |
length = swap | |
} | |
offset = Number(offset) || 0 | |
var remaining = this.length - offset | |
if (!length) { | |
length = remaining | |
} else { | |
length = Number(length) | |
if (length > remaining) { | |
length = remaining | |
} | |
} | |
encoding = String(encoding || 'utf8').toLowerCase() | |
var ret | |
switch (encoding) { | |
case 'hex': | |
ret = hexWrite(this, string, offset, length) | |
break | |
case 'utf8': | |
case 'utf-8': | |
ret = utf8Write(this, string, offset, length) | |
break | |
case 'ascii': | |
ret = asciiWrite(this, string, offset, length) | |
break | |
case 'binary': | |
ret = binaryWrite(this, string, offset, length) | |
break | |
case 'base64': | |
ret = base64Write(this, string, offset, length) | |
break | |
case 'ucs2': | |
case 'ucs-2': | |
case 'utf16le': | |
case 'utf-16le': | |
ret = utf16leWrite(this, string, offset, length) | |
break | |
default: | |
throw new Error('Unknown encoding') | |
} | |
return ret | |
} | |
Buffer.prototype.toString = function (encoding, start, end) { | |
var self = this | |
encoding = String(encoding || 'utf8').toLowerCase() | |
start = Number(start) || 0 | |
end = (end === undefined) ? self.length : Number(end) | |
// Fastpath empty strings | |
if (end === start) | |
return '' | |
var ret | |
switch (encoding) { | |
case 'hex': | |
ret = hexSlice(self, start, end) | |
break | |
case 'utf8': | |
case 'utf-8': | |
ret = utf8Slice(self, start, end) | |
break | |
case 'ascii': | |
ret = asciiSlice(self, start, end) | |
break | |
case 'binary': | |
ret = binarySlice(self, start, end) | |
break | |
case 'base64': | |
ret = base64Slice(self, start, end) | |
break | |
case 'ucs2': | |
case 'ucs-2': | |
case 'utf16le': | |
case 'utf-16le': | |
ret = utf16leSlice(self, start, end) | |
break | |
default: | |
throw new Error('Unknown encoding') | |
} | |
return ret | |
} | |
Buffer.prototype.toJSON = function () { | |
return { | |
type: 'Buffer', | |
data: Array.prototype.slice.call(this._arr || this, 0) | |
} | |
} | |
Buffer.prototype.equals = function (b) { | |
assert(Buffer.isBuffer(b), 'Argument must be a Buffer') | |
return Buffer.compare(this, b) === 0 | |
} | |
Buffer.prototype.compare = function (b) { | |
assert(Buffer.isBuffer(b), 'Argument must be a Buffer') | |
return Buffer.compare(this, b) | |
} | |
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) | |
Buffer.prototype.copy = function (target, target_start, start, end) { | |
var source = this | |
if (!start) start = 0 | |
if (!end && end !== 0) end = this.length | |
if (!target_start) target_start = 0 | |
// Copy 0 bytes; we're done | |
if (end === start) return | |
if (target.length === 0 || source.length === 0) return | |
// Fatal error conditions | |
assert(end >= start, 'sourceEnd < sourceStart') | |
assert(target_start >= 0 && target_start < target.length, | |
'targetStart out of bounds') | |
assert(start >= 0 && start < source.length, 'sourceStart out of bounds') | |
assert(end >= 0 && end <= source.length, 'sourceEnd out of bounds') | |
// Are we oob? | |
if (end > this.length) | |
end = this.length | |
if (target.length - target_start < end - start) | |
end = target.length - target_start + start | |
var len = end - start | |
if (len < 100 || !Buffer._useTypedArrays) { | |
for (var i = 0; i < len; i++) { | |
target[i + target_start] = this[i + start] | |
} | |
} else { | |
target._set(this.subarray(start, start + len), target_start) | |
} | |
} | |
function base64Slice (buf, start, end) { | |
if (start === 0 && end === buf.length) { | |
return base64.fromByteArray(buf) | |
} else { | |
return base64.fromByteArray(buf.slice(start, end)) | |
} | |
} | |
function utf8Slice (buf, start, end) { | |
var res = '' | |
var tmp = '' | |
end = Math.min(buf.length, end) | |
for (var i = start; i < end; i++) { | |
if (buf[i] <= 0x7F) { | |
res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i]) | |
tmp = '' | |
} else { | |
tmp += '%' + buf[i].toString(16) | |
} | |
} | |
return res + decodeUtf8Char(tmp) | |
} | |
function asciiSlice (buf, start, end) { | |
var ret = '' | |
end = Math.min(buf.length, end) | |
for (var i = start; i < end; i++) { | |
ret += String.fromCharCode(buf[i]) | |
} | |
return ret | |
} | |
function binarySlice (buf, start, end) { | |
return asciiSlice(buf, start, end) | |
} | |
function hexSlice (buf, start, end) { | |
var len = buf.length | |
if (!start || start < 0) start = 0 | |
if (!end || end < 0 || end > len) end = len | |
var out = '' | |
for (var i = start; i < end; i++) { | |
out += toHex(buf[i]) | |
} | |
return out | |
} | |
function utf16leSlice (buf, start, end) { | |
var bytes = buf.slice(start, end) | |
var res = '' | |
for (var i = 0; i < bytes.length; i += 2) { | |
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) | |
} | |
return res | |
} | |
Buffer.prototype.slice = function (start, end) { | |
var len = this.length | |
start = ~~start | |
end = end === undefined ? len : ~~end | |
if (start < 0) { | |
start += len; | |
if (start < 0) | |
start = 0 | |
} else if (start > len) { | |
start = len | |
} | |
if (end < 0) { | |
end += len | |
if (end < 0) | |
end = 0 | |
} else if (end > len) { | |
end = len | |
} | |
if (end < start) | |
end = start | |
if (Buffer._useTypedArrays) { | |
return Buffer._augment(this.subarray(start, end)) | |
} else { | |
var sliceLen = end - start | |
var newBuf = new Buffer(sliceLen, undefined, true) | |
for (var i = 0; i < sliceLen; i++) { | |
newBuf[i] = this[i + start] | |
} | |
return newBuf | |
} | |
} | |
// `get` will be removed in Node 0.13+ | |
Buffer.prototype.get = function (offset) { | |
console.log('.get() is deprecated. Access using array indexes instead.') | |
return this.readUInt8(offset) | |
} | |
// `set` will be removed in Node 0.13+ | |
Buffer.prototype.set = function (v, offset) { | |
console.log('.set() is deprecated. Access using array indexes instead.') | |
return this.writeUInt8(v, offset) | |
} | |
Buffer.prototype.readUInt8 = function (offset, noAssert) { | |
if (!noAssert) { | |
assert(offset !== undefined && offset !== null, 'missing offset') | |
assert(offset < this.length, 'Trying to read beyond buffer length') | |
} | |
if (offset >= this.length) | |
return | |
return this[offset] | |
} | |
function readUInt16 (buf, offset, littleEndian, noAssert) { | |
if (!noAssert) { | |
assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
assert(offset !== undefined && offset !== null, 'missing offset') | |
assert(offset + 1 < buf.length, 'Trying to read beyond buffer length') | |
} | |
var len = buf.length | |
if (offset >= len) | |
return | |
var val | |
if (littleEndian) { | |
val = buf[offset] | |
if (offset + 1 < len) | |
val |= buf[offset + 1] << 8 | |
} else { | |
val = buf[offset] << 8 | |
if (offset + 1 < len) | |
val |= buf[offset + 1] | |
} | |
return val | |
} | |
Buffer.prototype.readUInt16LE = function (offset, noAssert) { | |
return readUInt16(this, offset, true, noAssert) | |
} | |
Buffer.prototype.readUInt16BE = function (offset, noAssert) { | |
return readUInt16(this, offset, false, noAssert) | |
} | |
function readUInt32 (buf, offset, littleEndian, noAssert) { | |
if (!noAssert) { | |
assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
assert(offset !== undefined && offset !== null, 'missing offset') | |
assert(offset + 3 < buf.length, 'Trying to read beyond buffer length') | |
} | |
var len = buf.length | |
if (offset >= len) | |
return | |
var val | |
if (littleEndian) { | |
if (offset + 2 < len) | |
val = buf[offset + 2] << 16 | |
if (offset + 1 < len) | |
val |= buf[offset + 1] << 8 | |
val |= buf[offset] | |
if (offset + 3 < len) | |
val = val + (buf[offset + 3] << 24 >>> 0) | |
} else { | |
if (offset + 1 < len) | |
val = buf[offset + 1] << 16 | |
if (offset + 2 < len) | |
val |= buf[offset + 2] << 8 | |
if (offset + 3 < len) | |
val |= buf[offset + 3] | |
val = val + (buf[offset] << 24 >>> 0) | |
} | |
return val | |
} | |
Buffer.prototype.readUInt32LE = function (offset, noAssert) { | |
return readUInt32(this, offset, true, noAssert) | |
} | |
Buffer.prototype.readUInt32BE = function (offset, noAssert) { | |
return readUInt32(this, offset, false, noAssert) | |
} | |
Buffer.prototype.readInt8 = function (offset, noAssert) { | |
if (!noAssert) { | |
assert(offset !== undefined && offset !== null, | |
'missing offset') | |
assert(offset < this.length, 'Trying to read beyond buffer length') | |
} | |
if (offset >= this.length) | |
return | |
var neg = this[offset] & 0x80 | |
if (neg) | |
return (0xff - this[offset] + 1) * -1 | |
else | |
return this[offset] | |
} | |
function readInt16 (buf, offset, littleEndian, noAssert) { | |
if (!noAssert) { | |
assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
assert(offset !== undefined && offset !== null, 'missing offset') | |
assert(offset + 1 < buf.length, 'Trying to read beyond buffer length') | |
} | |
var len = buf.length | |
if (offset >= len) | |
return | |
var val = readUInt16(buf, offset, littleEndian, true) | |
var neg = val & 0x8000 | |
if (neg) | |
return (0xffff - val + 1) * -1 | |
else | |
return val | |
} | |
Buffer.prototype.readInt16LE = function (offset, noAssert) { | |
return readInt16(this, offset, true, noAssert) | |
} | |
Buffer.prototype.readInt16BE = function (offset, noAssert) { | |
return readInt16(this, offset, false, noAssert) | |
} | |
function readInt32 (buf, offset, littleEndian, noAssert) { | |
if (!noAssert) { | |
assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
assert(offset !== undefined && offset !== null, 'missing offset') | |
assert(offset + 3 < buf.length, 'Trying to read beyond buffer length') | |
} | |
var len = buf.length | |
if (offset >= len) | |
return | |
var val = readUInt32(buf, offset, littleEndian, true) | |
var neg = val & 0x80000000 | |
if (neg) | |
return (0xffffffff - val + 1) * -1 | |
else | |
return val | |
} | |
Buffer.prototype.readInt32LE = function (offset, noAssert) { | |
return readInt32(this, offset, true, noAssert) | |
} | |
Buffer.prototype.readInt32BE = function (offset, noAssert) { | |
return readInt32(this, offset, false, noAssert) | |
} | |
function readFloat (buf, offset, littleEndian, noAssert) { | |
if (!noAssert) { | |
assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
assert(offset + 3 < buf.length, 'Trying to read beyond buffer length') | |
} | |
return ieee754.read(buf, offset, littleEndian, 23, 4) | |
} | |
Buffer.prototype.readFloatLE = function (offset, noAssert) { | |
return readFloat(this, offset, true, noAssert) | |
} | |
Buffer.prototype.readFloatBE = function (offset, noAssert) { | |
return readFloat(this, offset, false, noAssert) | |
} | |
function readDouble (buf, offset, littleEndian, noAssert) { | |
if (!noAssert) { | |
assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
assert(offset + 7 < buf.length, 'Trying to read beyond buffer length') | |
} | |
return ieee754.read(buf, offset, littleEndian, 52, 8) | |
} | |
Buffer.prototype.readDoubleLE = function (offset, noAssert) { | |
return readDouble(this, offset, true, noAssert) | |
} | |
Buffer.prototype.readDoubleBE = function (offset, noAssert) { | |
return readDouble(this, offset, false, noAssert) | |
} | |
Buffer.prototype.writeUInt8 = function (value, offset, noAssert) { | |
if (!noAssert) { | |
assert(value !== undefined && value !== null, 'missing value') | |
assert(offset !== undefined && offset !== null, 'missing offset') | |
assert(offset < this.length, 'trying to write beyond buffer length') | |
verifuint(value, 0xff) | |
} | |
if (offset >= this.length) return | |
this[offset] = value | |
return offset + 1 | |
} | |
function writeUInt16 (buf, value, offset, littleEndian, noAssert) { | |
if (!noAssert) { | |
assert(value !== undefined && value !== null, 'missing value') | |
assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
assert(offset !== undefined && offset !== null, 'missing offset') | |
assert(offset + 1 < buf.length, 'trying to write beyond buffer length') | |
verifuint(value, 0xffff) | |
} | |
var len = buf.length | |
if (offset >= len) | |
return | |
for (var i = 0, j = Math.min(len - offset, 2); i < j; i++) { | |
buf[offset + i] = | |
(value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> | |
(littleEndian ? i : 1 - i) * 8 | |
} | |
return offset + 2 | |
} | |
Buffer.prototype.writeUInt16LE = function (value, offset, noAssert) { | |
return writeUInt16(this, value, offset, true, noAssert) | |
} | |
Buffer.prototype.writeUInt16BE = function (value, offset, noAssert) { | |
return writeUInt16(this, value, offset, false, noAssert) | |
} | |
function writeUInt32 (buf, value, offset, littleEndian, noAssert) { | |
if (!noAssert) { | |
assert(value !== undefined && value !== null, 'missing value') | |
assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
assert(offset !== undefined && offset !== null, 'missing offset') | |
assert(offset + 3 < buf.length, 'trying to write beyond buffer length') | |
verifuint(value, 0xffffffff) | |
} | |
var len = buf.length | |
if (offset >= len) | |
return | |
for (var i = 0, j = Math.min(len - offset, 4); i < j; i++) { | |
buf[offset + i] = | |
(value >>> (littleEndian ? i : 3 - i) * 8) & 0xff | |
} | |
return offset + 4 | |
} | |
Buffer.prototype.writeUInt32LE = function (value, offset, noAssert) { | |
return writeUInt32(this, value, offset, true, noAssert) | |
} | |
Buffer.prototype.writeUInt32BE = function (value, offset, noAssert) { | |
return writeUInt32(this, value, offset, false, noAssert) | |
} | |
Buffer.prototype.writeInt8 = function (value, offset, noAssert) { | |
if (!noAssert) { | |
assert(value !== undefined && value !== null, 'missing value') | |
assert(offset !== undefined && offset !== null, 'missing offset') | |
assert(offset < this.length, 'Trying to write beyond buffer length') | |
verifsint(value, 0x7f, -0x80) | |
} | |
if (offset >= this.length) | |
return | |
if (value >= 0) | |
this.writeUInt8(value, offset, noAssert) | |
else | |
this.writeUInt8(0xff + value + 1, offset, noAssert) | |
return offset + 1 | |
} | |
function writeInt16 (buf, value, offset, littleEndian, noAssert) { | |
if (!noAssert) { | |
assert(value !== undefined && value !== null, 'missing value') | |
assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
assert(offset !== undefined && offset !== null, 'missing offset') | |
assert(offset + 1 < buf.length, 'Trying to write beyond buffer length') | |
verifsint(value, 0x7fff, -0x8000) | |
} | |
var len = buf.length | |
if (offset >= len) | |
return | |
if (value >= 0) | |
writeUInt16(buf, value, offset, littleEndian, noAssert) | |
else | |
writeUInt16(buf, 0xffff + value + 1, offset, littleEndian, noAssert) | |
return offset + 2 | |
} | |
Buffer.prototype.writeInt16LE = function (value, offset, noAssert) { | |
return writeInt16(this, value, offset, true, noAssert) | |
} | |
Buffer.prototype.writeInt16BE = function (value, offset, noAssert) { | |
return writeInt16(this, value, offset, false, noAssert) | |
} | |
function writeInt32 (buf, value, offset, littleEndian, noAssert) { | |
if (!noAssert) { | |
assert(value !== undefined && value !== null, 'missing value') | |
assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
assert(offset !== undefined && offset !== null, 'missing offset') | |
assert(offset + 3 < buf.length, 'Trying to write beyond buffer length') | |
verifsint(value, 0x7fffffff, -0x80000000) | |
} | |
var len = buf.length | |
if (offset >= len) | |
return | |
if (value >= 0) | |
writeUInt32(buf, value, offset, littleEndian, noAssert) | |
else | |
writeUInt32(buf, 0xffffffff + value + 1, offset, littleEndian, noAssert) | |
return offset + 4 | |
} | |
Buffer.prototype.writeInt32LE = function (value, offset, noAssert) { | |
return writeInt32(this, value, offset, true, noAssert) | |
} | |
Buffer.prototype.writeInt32BE = function (value, offset, noAssert) { | |
return writeInt32(this, value, offset, false, noAssert) | |
} | |
function writeFloat (buf, value, offset, littleEndian, noAssert) { | |
if (!noAssert) { | |
assert(value !== undefined && value !== null, 'missing value') | |
assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
assert(offset !== undefined && offset !== null, 'missing offset') | |
assert(offset + 3 < buf.length, 'Trying to write beyond buffer length') | |
verifIEEE754(value, 3.4028234663852886e+38, -3.4028234663852886e+38) | |
} | |
var len = buf.length | |
if (offset >= len) | |
return | |
ieee754.write(buf, value, offset, littleEndian, 23, 4) | |
return offset + 4 | |
} | |
Buffer.prototype.writeFloatLE = function (value, offset, noAssert) { | |
return writeFloat(this, value, offset, true, noAssert) | |
} | |
Buffer.prototype.writeFloatBE = function (value, offset, noAssert) { | |
return writeFloat(this, value, offset, false, noAssert) | |
} | |
function writeDouble (buf, value, offset, littleEndian, noAssert) { | |
if (!noAssert) { | |
assert(value !== undefined && value !== null, 'missing value') | |
assert(typeof littleEndian === 'boolean', 'missing or invalid endian') | |
assert(offset !== undefined && offset !== null, 'missing offset') | |
assert(offset + 7 < buf.length, | |
'Trying to write beyond buffer length') | |
verifIEEE754(value, 1.7976931348623157E+308, -1.7976931348623157E+308) | |
} | |
var len = buf.length | |
if (offset >= len) | |
return | |
ieee754.write(buf, value, offset, littleEndian, 52, 8) | |
return offset + 8 | |
} | |
Buffer.prototype.writeDoubleLE = function (value, offset, noAssert) { | |
return writeDouble(this, value, offset, true, noAssert) | |
} | |
Buffer.prototype.writeDoubleBE = function (value, offset, noAssert) { | |
return writeDouble(this, value, offset, false, noAssert) | |
} | |
// fill(value, start=0, end=buffer.length) | |
Buffer.prototype.fill = function (value, start, end) { | |
if (!value) value = 0 | |
if (!start) start = 0 | |
if (!end) end = this.length | |
assert(end >= start, 'end < start') | |
// Fill 0 bytes; we're done | |
if (end === start) return | |
if (this.length === 0) return | |
assert(start >= 0 && start < this.length, 'start out of bounds') | |
assert(end >= 0 && end <= this.length, 'end out of bounds') | |
var i | |
if (typeof value === 'number') { | |
for (i = start; i < end; i++) { | |
this[i] = value | |
} | |
} else { | |
var bytes = utf8ToBytes(value.toString()) | |
var len = bytes.length | |
for (i = start; i < end; i++) { | |
this[i] = bytes[i % len] | |
} | |
} | |
return this | |
} | |
Buffer.prototype.inspect = function () { | |
var out = [] | |
var len = this.length | |
for (var i = 0; i < len; i++) { | |
out[i] = toHex(this[i]) | |
if (i === exports.INSPECT_MAX_BYTES) { | |
out[i + 1] = '...' | |
break | |
} | |
} | |
return '<Buffer ' + out.join(' ') + '>' | |
} | |
/** | |
* Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance. | |
* Added in Node 0.12. Only available in browsers that support ArrayBuffer. | |
*/ | |
Buffer.prototype.toArrayBuffer = function () { | |
if (typeof Uint8Array !== 'undefined') { | |
if (Buffer._useTypedArrays) { | |
return (new Buffer(this)).buffer | |
} else { | |
var buf = new Uint8Array(this.length) | |
for (var i = 0, len = buf.length; i < len; i += 1) { | |
buf[i] = this[i] | |
} | |
return buf.buffer | |
} | |
} else { | |
throw new Error('Buffer.toArrayBuffer not supported in this browser') | |
} | |
} | |
// HELPER FUNCTIONS | |
// ================ | |
var BP = Buffer.prototype | |
/** | |
* Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods | |
*/ | |
Buffer._augment = function (arr) { | |
arr._isBuffer = true | |
// save reference to original Uint8Array get/set methods before overwriting | |
arr._get = arr.get | |
arr._set = arr.set | |
// deprecated, will be removed in node 0.13+ | |
arr.get = BP.get | |
arr.set = BP.set | |
arr.write = BP.write | |
arr.toString = BP.toString | |
arr.toLocaleString = BP.toString | |
arr.toJSON = BP.toJSON | |
arr.equals = BP.equals | |
arr.compare = BP.compare | |
arr.copy = BP.copy | |
arr.slice = BP.slice | |
arr.readUInt8 = BP.readUInt8 | |
arr.readUInt16LE = BP.readUInt16LE | |
arr.readUInt16BE = BP.readUInt16BE | |
arr.readUInt32LE = BP.readUInt32LE | |
arr.readUInt32BE = BP.readUInt32BE | |
arr.readInt8 = BP.readInt8 | |
arr.readInt16LE = BP.readInt16LE | |
arr.readInt16BE = BP.readInt16BE | |
arr.readInt32LE = BP.readInt32LE | |
arr.readInt32BE = BP.readInt32BE | |
arr.readFloatLE = BP.readFloatLE | |
arr.readFloatBE = BP.readFloatBE | |
arr.readDoubleLE = BP.readDoubleLE | |
arr.readDoubleBE = BP.readDoubleBE | |
arr.writeUInt8 = BP.writeUInt8 | |
arr.writeUInt16LE = BP.writeUInt16LE | |
arr.writeUInt16BE = BP.writeUInt16BE | |
arr.writeUInt32LE = BP.writeUInt32LE | |
arr.writeUInt32BE = BP.writeUInt32BE | |
arr.writeInt8 = BP.writeInt8 | |
arr.writeInt16LE = BP.writeInt16LE | |
arr.writeInt16BE = BP.writeInt16BE | |
arr.writeInt32LE = BP.writeInt32LE | |
arr.writeInt32BE = BP.writeInt32BE | |
arr.writeFloatLE = BP.writeFloatLE | |
arr.writeFloatBE = BP.writeFloatBE | |
arr.writeDoubleLE = BP.writeDoubleLE | |
arr.writeDoubleBE = BP.writeDoubleBE | |
arr.fill = BP.fill | |
arr.inspect = BP.inspect | |
arr.toArrayBuffer = BP.toArrayBuffer | |
return arr | |
} | |
var INVALID_BASE64_RE = /[^+\/0-9A-z]/g | |
function base64clean (str) { | |
// Node strips out invalid characters like \n and \t from the string, base64-js does not | |
str = stringtrim(str).replace(INVALID_BASE64_RE, '') | |
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not | |
while (str.length % 4 !== 0) { | |
str = str + '=' | |
} | |
return str | |
} | |
function stringtrim (str) { | |
if (str.trim) return str.trim() | |
return str.replace(/^\s+|\s+$/g, '') | |
} | |
function isArray (subject) { | |
return (Array.isArray || function (subject) { | |
return Object.prototype.toString.call(subject) === '[object Array]' | |
})(subject) | |
} | |
function isArrayish (subject) { | |
return isArray(subject) || Buffer.isBuffer(subject) || | |
subject && typeof subject === 'object' && | |
typeof subject.length === 'number' | |
} | |
function toHex (n) { | |
if (n < 16) return '0' + n.toString(16) | |
return n.toString(16) | |
} | |
function utf8ToBytes (str) { | |
var byteArray = [] | |
for (var i = 0; i < str.length; i++) { | |
var b = str.charCodeAt(i) | |
if (b <= 0x7F) { | |
byteArray.push(b) | |
} else { | |
var start = i | |
if (b >= 0xD800 && b <= 0xDFFF) i++ | |
var h = encodeURIComponent(str.slice(start, i+1)).substr(1).split('%') | |
for (var j = 0; j < h.length; j++) { | |
byteArray.push(parseInt(h[j], 16)) | |
} | |
} | |
} | |
return byteArray | |
} | |
function asciiToBytes (str) { | |
var byteArray = [] | |
for (var i = 0; i < str.length; i++) { | |
// Node's code seems to be doing this and not & 0x7F.. | |
byteArray.push(str.charCodeAt(i) & 0xFF) | |
} | |
return byteArray | |
} | |
function utf16leToBytes (str) { | |
var c, hi, lo | |
var byteArray = [] | |
for (var i = 0; i < str.length; i++) { | |
c = str.charCodeAt(i) | |
hi = c >> 8 | |
lo = c % 256 | |
byteArray.push(lo) | |
byteArray.push(hi) | |
} | |
return byteArray | |
} | |
function base64ToBytes (str) { | |
return base64.toByteArray(str) | |
} | |
function blitBuffer (src, dst, offset, length) { | |
for (var i = 0; i < length; i++) { | |
if ((i + offset >= dst.length) || (i >= src.length)) | |
break | |
dst[i + offset] = src[i] | |
} | |
return i | |
} | |
function decodeUtf8Char (str) { | |
try { | |
return decodeURIComponent(str) | |
} catch (err) { | |
return String.fromCharCode(0xFFFD) // UTF 8 invalid char | |
} | |
} | |
/* | |
* We have to make sure that the value is a valid integer. This means that it | |
* is non-negative. It has no fractional component and that it does not | |
* exceed the maximum allowed value. | |
*/ | |
function verifuint (value, max) { | |
assert(typeof value === 'number', 'cannot write a non-number as a number') | |
assert(value >= 0, 'specified a negative value for writing an unsigned value') | |
assert(value <= max, 'value is larger than maximum value for type') | |
assert(Math.floor(value) === value, 'value has a fractional component') | |
} | |
function verifsint (value, max, min) { | |
assert(typeof value === 'number', 'cannot write a non-number as a number') | |
assert(value <= max, 'value larger than maximum allowed value') | |
assert(value >= min, 'value smaller than minimum allowed value') | |
assert(Math.floor(value) === value, 'value has a fractional component') | |
} | |
function verifIEEE754 (value, max, min) { | |
assert(typeof value === 'number', 'cannot write a non-number as a number') | |
assert(value <= max, 'value larger than maximum allowed value') | |
assert(value >= min, 'value smaller than minimum allowed value') | |
} | |
function assert (test, message) { | |
if (!test) throw new Error(message || 'Failed assertion') | |
} | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! (webpack)/~/node-libs-browser/~/buffer/index.js */ 71).Buffer)) | |
/***/ }, | |
/* 72 */ | |
/*!*********************************************!*\ | |
!*** ./~/jsdom/~/htmlparser2/lib/Parser.js ***! | |
\*********************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var Tokenizer = __webpack_require__(/*! ./Tokenizer.js */ 73); | |
/* | |
Options: | |
xmlMode: Special behavior for script/style tags (true by default) | |
lowerCaseAttributeNames: call .toLowerCase for each attribute name (true if xmlMode is `false`) | |
lowerCaseTags: call .toLowerCase for each tag name (true if xmlMode is `false`) | |
*/ | |
/* | |
Callbacks: | |
oncdataend, | |
oncdatastart, | |
onclosetag, | |
oncomment, | |
oncommentend, | |
onerror, | |
onopentag, | |
onprocessinginstruction, | |
onreset, | |
ontext | |
*/ | |
var formTags = { | |
input: true, | |
option: true, | |
optgroup: true, | |
select: true, | |
button: true, | |
datalist: true, | |
textarea: true | |
}; | |
var openImpliesClose = { | |
tr : { tr:true, th:true, td:true }, | |
th : { th:true }, | |
td : { thead:true, td:true }, | |
body : { head:true, link:true, script:true }, | |
li : { li:true }, | |
p : { p:true }, | |
select : formTags, | |
input : formTags, | |
output : formTags, | |
button : formTags, | |
datalist: formTags, | |
textarea: formTags, | |
option : { option:true }, | |
optgroup: { optgroup:true } | |
}; | |
var voidElements = { | |
__proto__: null, | |
area: true, | |
base: true, | |
basefont: true, | |
br: true, | |
col: true, | |
command: true, | |
embed: true, | |
frame: true, | |
hr: true, | |
img: true, | |
input: true, | |
isindex: true, | |
keygen: true, | |
link: true, | |
meta: true, | |
param: true, | |
source: true, | |
track: true, | |
wbr: true, | |
//common self closing svg elements | |
path: true, | |
circle: true, | |
ellipse: true, | |
line: true, | |
rect: true, | |
use: true | |
}; | |
var re_nameEnd = /\s|\//; | |
function Parser(cbs, options){ | |
this._options = options || {}; | |
this._cbs = cbs || {}; | |
this._tagname = ""; | |
this._attribname = ""; | |
this._attribvalue = ""; | |
this._attribs = null; | |
this._stack = []; | |
this.startIndex = 0; | |
this.endIndex = null; | |
this._lowerCaseTagNames = "lowerCaseTags" in this._options ? | |
!!this._options.lowerCaseTags : | |
!this._options.xmlMode; | |
this._lowerCaseAttributeNames = "lowerCaseAttributeNames" in this._options ? | |
!!this._options.lowerCaseAttributeNames : | |
!this._options.xmlMode; | |
this._tokenizer = new Tokenizer(this._options, this); | |
} | |
__webpack_require__(/*! util */ 87).inherits(Parser, __webpack_require__(/*! events */ 94).EventEmitter); | |
Parser.prototype._updatePosition = function(initialOffset){ | |
if(this.endIndex === null){ | |
if(this._tokenizer._sectionStart <= initialOffset){ | |
this.startIndex = 0; | |
} else { | |
this.startIndex = this._tokenizer._sectionStart - initialOffset; | |
} | |
} | |
else this.startIndex = this.endIndex + 1; | |
this.endIndex = this._tokenizer._index; | |
}; | |
//Tokenizer event handlers | |
Parser.prototype.ontext = function(data){ | |
this._updatePosition(1); | |
this.endIndex--; | |
if(this._cbs.ontext) this._cbs.ontext(data); | |
}; | |
Parser.prototype.onopentagname = function(name){ | |
if(this._lowerCaseTagNames){ | |
name = name.toLowerCase(); | |
} | |
this._tagname = name; | |
if (!this._options.xmlMode && name in openImpliesClose) { | |
for( | |
var el; | |
(el = this._stack[this._stack.length-1]) in openImpliesClose[name]; | |
this.onclosetag(el) | |
); | |
} | |
if(this._options.xmlMode || !(name in voidElements)){ | |
this._stack.push(name); | |
} | |
if(this._cbs.onopentagname) this._cbs.onopentagname(name); | |
if(this._cbs.onopentag) this._attribs = {}; | |
}; | |
Parser.prototype.onopentagend = function(){ | |
this._updatePosition(1); | |
if(this._attribs){ | |
if(this._cbs.onopentag) this._cbs.onopentag(this._tagname, this._attribs); | |
this._attribs = null; | |
} | |
if(!this._options.xmlMode && this._cbs.onclosetag && this._tagname in voidElements){ | |
this._cbs.onclosetag(this._tagname); | |
} | |
this._tagname = ""; | |
}; | |
Parser.prototype.onclosetag = function(name){ | |
this._updatePosition(1); | |
if(this._lowerCaseTagNames){ | |
name = name.toLowerCase(); | |
} | |
if(this._stack.length && (!(name in voidElements) || this._options.xmlMode)){ | |
var pos = this._stack.lastIndexOf(name); | |
if(pos !== -1){ | |
if(this._cbs.onclosetag){ | |
pos = this._stack.length - pos; | |
while(pos--) this._cbs.onclosetag(this._stack.pop()); | |
} | |
else this._stack.length = pos; | |
} else if(name === "p" && !this._options.xmlMode){ | |
this.onopentagname(name); | |
this._closeCurrentTag(); | |
} | |
} else if(!this._options.xmlMode && (name === "br" || name === "p")){ | |
this.onopentagname(name); | |
this._closeCurrentTag(); | |
} | |
}; | |
Parser.prototype.onselfclosingtag = function(){ | |
if(this._options.xmlMode || this._options.recognizeSelfClosing){ | |
this._closeCurrentTag(); | |
} else { | |
this.onopentagend(); | |
} | |
}; | |
Parser.prototype._closeCurrentTag = function(){ | |
var name = this._tagname; | |
this.onopentagend(); | |
//self-closing tags will be on the top of the stack | |
//(cheaper check than in onclosetag) | |
if(this._stack[this._stack.length-1] === name){ | |
if(this._cbs.onclosetag){ | |
this._cbs.onclosetag(name); | |
} | |
this._stack.pop(); | |
} | |
}; | |
Parser.prototype.onattribname = function(name){ | |
if(this._lowerCaseAttributeNames){ | |
name = name.toLowerCase(); | |
} | |
this._attribname = name; | |
}; | |
Parser.prototype.onattribdata = function(value){ | |
this._attribvalue += value; | |
}; | |
Parser.prototype.onattribend = function(){ | |
if(this._cbs.onattribute) this._cbs.onattribute(this._attribname, this._attribvalue); | |
if( | |
this._attribs && | |
!Object.prototype.hasOwnProperty.call(this._attribs, this._attribname) | |
){ | |
this._attribs[this._attribname] = this._attribvalue; | |
} | |
this._attribname = ""; | |
this._attribvalue = ""; | |
}; | |
Parser.prototype._getInstructionName = function(value){ | |
var idx = value.search(re_nameEnd), | |
name = idx < 0 ? value : value.substr(0, idx); | |
if(this._lowerCaseTagNames){ | |
name = name.toLowerCase(); | |
} | |
return name; | |
}; | |
Parser.prototype.ondeclaration = function(value){ | |
if(this._cbs.onprocessinginstruction){ | |
var name = this._getInstructionName(value); | |
this._cbs.onprocessinginstruction("!" + name, "!" + value); | |
} | |
}; | |
Parser.prototype.onprocessinginstruction = function(value){ | |
if(this._cbs.onprocessinginstruction){ | |
var name = this._getInstructionName(value); | |
this._cbs.onprocessinginstruction("?" + name, "?" + value); | |
} | |
}; | |
Parser.prototype.oncomment = function(value){ | |
this._updatePosition(4); | |
if(this._cbs.oncomment) this._cbs.oncomment(value); | |
if(this._cbs.oncommentend) this._cbs.oncommentend(); | |
}; | |
Parser.prototype.oncdata = function(value){ | |
this._updatePosition(1); | |
if(this._options.xmlMode || this._options.recognizeCDATA){ | |
if(this._cbs.oncdatastart) this._cbs.oncdatastart(); | |
if(this._cbs.ontext) this._cbs.ontext(value); | |
if(this._cbs.oncdataend) this._cbs.oncdataend(); | |
} else { | |
this.oncomment("[CDATA[" + value + "]]"); | |
} | |
}; | |
Parser.prototype.onerror = function(err){ | |
if(this._cbs.onerror) this._cbs.onerror(err); | |
}; | |
Parser.prototype.onend = function(){ | |
if(this._cbs.onclosetag){ | |
for( | |
var i = this._stack.length; | |
i > 0; | |
this._cbs.onclosetag(this._stack[--i]) | |
); | |
} | |
if(this._cbs.onend) this._cbs.onend(); | |
}; | |
//Resets the parser to a blank state, ready to parse a new HTML document | |
Parser.prototype.reset = function(){ | |
if(this._cbs.onreset) this._cbs.onreset(); | |
this._tokenizer.reset(); | |
this._tagname = ""; | |
this._attribname = ""; | |
this._attribs = null; | |
this._stack = []; | |
}; | |
//Parses a complete HTML document and pushes it to the handler | |
Parser.prototype.parseComplete = function(data){ | |
this.reset(); | |
this.end(data); | |
}; | |
Parser.prototype.write = function(chunk){ | |
this._tokenizer.write(chunk); | |
}; | |
Parser.prototype.end = function(chunk){ | |
this._tokenizer.end(chunk); | |
}; | |
Parser.prototype.pause = function(){ | |
this._tokenizer.pause(); | |
}; | |
Parser.prototype.resume = function(){ | |
this._tokenizer.resume(); | |
}; | |
//alias for backwards compat | |
Parser.prototype.parseChunk = Parser.prototype.write; | |
Parser.prototype.done = Parser.prototype.end; | |
module.exports = Parser; | |
/***/ }, | |
/* 73 */ | |
/*!************************************************!*\ | |
!*** ./~/jsdom/~/htmlparser2/lib/Tokenizer.js ***! | |
\************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
module.exports = Tokenizer; | |
var decodeCodePoint = __webpack_require__(/*! entities/lib/decode_codepoint.js */ 105), | |
entityMap = __webpack_require__(/*! entities/maps/entities.json */ 109), | |
legacyMap = __webpack_require__(/*! entities/maps/legacy.json */ 110), | |
xmlMap = __webpack_require__(/*! entities/maps/xml.json */ 111), | |
i = 0, | |
TEXT = i++, | |
BEFORE_TAG_NAME = i++, //after < | |
IN_TAG_NAME = i++, | |
IN_SELF_CLOSING_TAG = i++, | |
BEFORE_CLOSING_TAG_NAME = i++, | |
IN_CLOSING_TAG_NAME = i++, | |
AFTER_CLOSING_TAG_NAME = i++, | |
//attributes | |
BEFORE_ATTRIBUTE_NAME = i++, | |
IN_ATTRIBUTE_NAME = i++, | |
AFTER_ATTRIBUTE_NAME = i++, | |
BEFORE_ATTRIBUTE_VALUE = i++, | |
IN_ATTRIBUTE_VALUE_DQ = i++, // " | |
IN_ATTRIBUTE_VALUE_SQ = i++, // ' | |
IN_ATTRIBUTE_VALUE_NQ = i++, | |
//declarations | |
BEFORE_DECLARATION = i++, // ! | |
IN_DECLARATION = i++, | |
//processing instructions | |
IN_PROCESSING_INSTRUCTION = i++, // ? | |
//comments | |
BEFORE_COMMENT = i++, | |
IN_COMMENT = i++, | |
AFTER_COMMENT_1 = i++, | |
AFTER_COMMENT_2 = i++, | |
//cdata | |
BEFORE_CDATA_1 = i++, // [ | |
BEFORE_CDATA_2 = i++, // C | |
BEFORE_CDATA_3 = i++, // D | |
BEFORE_CDATA_4 = i++, // A | |
BEFORE_CDATA_5 = i++, // T | |
BEFORE_CDATA_6 = i++, // A | |
IN_CDATA = i++, // [ | |
AFTER_CDATA_1 = i++, // ] | |
AFTER_CDATA_2 = i++, // ] | |
//special tags | |
BEFORE_SPECIAL = i++, //S | |
BEFORE_SPECIAL_END = i++, //S | |
BEFORE_SCRIPT_1 = i++, //C | |
BEFORE_SCRIPT_2 = i++, //R | |
BEFORE_SCRIPT_3 = i++, //I | |
BEFORE_SCRIPT_4 = i++, //P | |
BEFORE_SCRIPT_5 = i++, //T | |
AFTER_SCRIPT_1 = i++, //C | |
AFTER_SCRIPT_2 = i++, //R | |
AFTER_SCRIPT_3 = i++, //I | |
AFTER_SCRIPT_4 = i++, //P | |
AFTER_SCRIPT_5 = i++, //T | |
BEFORE_STYLE_1 = i++, //T | |
BEFORE_STYLE_2 = i++, //Y | |
BEFORE_STYLE_3 = i++, //L | |
BEFORE_STYLE_4 = i++, //E | |
AFTER_STYLE_1 = i++, //T | |
AFTER_STYLE_2 = i++, //Y | |
AFTER_STYLE_3 = i++, //L | |
AFTER_STYLE_4 = i++, //E | |
BEFORE_ENTITY = i++, //& | |
BEFORE_NUMERIC_ENTITY = i++, //# | |
IN_NAMED_ENTITY = i++, | |
IN_NUMERIC_ENTITY = i++, | |
IN_HEX_ENTITY = i++, //X | |
j = 0, | |
SPECIAL_NONE = j++, | |
SPECIAL_SCRIPT = j++, | |
SPECIAL_STYLE = j++; | |
function whitespace(c){ | |
return c === " " || c === "\n" || c === "\t" || c === "\f" || c === "\r"; | |
} | |
function characterState(char, SUCCESS){ | |
return function(c){ | |
if(c === char) this._state = SUCCESS; | |
}; | |
} | |
function ifElseState(upper, SUCCESS, FAILURE){ | |
var lower = upper.toLowerCase(); | |
if(upper === lower){ | |
return function(c){ | |
if(c === lower){ | |
this._state = SUCCESS; | |
} else { | |
this._state = FAILURE; | |
this._index--; | |
} | |
}; | |
} else { | |
return function(c){ | |
if(c === lower || c === upper){ | |
this._state = SUCCESS; | |
} else { | |
this._state = FAILURE; | |
this._index--; | |
} | |
}; | |
} | |
} | |
function consumeSpecialNameChar(upper, NEXT_STATE){ | |
var lower = upper.toLowerCase(); | |
return function(c){ | |
if(c === lower || c === upper){ | |
this._state = NEXT_STATE; | |
} else { | |
this._state = IN_TAG_NAME; | |
this._index--; //consume the token again | |
} | |
}; | |
} | |
function Tokenizer(options, cbs){ | |
this._state = TEXT; | |
this._buffer = ""; | |
this._sectionStart = 0; | |
this._index = 0; | |
this._baseState = TEXT; | |
this._special = SPECIAL_NONE; | |
this._cbs = cbs; | |
this._running = true; | |
this._ended = false; | |
this._xmlMode = !!(options && options.xmlMode); | |
this._decodeEntities = !!(options && options.decodeEntities); | |
} | |
Tokenizer.prototype._stateText = function(c){ | |
if(c === "<"){ | |
if(this._index > this._sectionStart){ | |
this._cbs.ontext(this._getSection()); | |
} | |
this._state = BEFORE_TAG_NAME; | |
this._sectionStart = this._index; | |
} else if(this._decodeEntities && this._special === SPECIAL_NONE && c === "&"){ | |
if(this._index > this._sectionStart){ | |
this._cbs.ontext(this._getSection()); | |
} | |
this._baseState = TEXT; | |
this._state = BEFORE_ENTITY; | |
this._sectionStart = this._index; | |
} | |
}; | |
Tokenizer.prototype._stateBeforeTagName = function(c){ | |
if(c === "/"){ | |
this._state = BEFORE_CLOSING_TAG_NAME; | |
} else if(c === ">" || this._special !== SPECIAL_NONE || whitespace(c)) { | |
this._state = TEXT; | |
} else if(c === "!"){ | |
this._state = BEFORE_DECLARATION; | |
this._sectionStart = this._index + 1; | |
} else if(c === "?"){ | |
this._state = IN_PROCESSING_INSTRUCTION; | |
this._sectionStart = this._index + 1; | |
} else if(c === "<"){ | |
this._cbs.ontext(this._getSection()); | |
this._sectionStart = this._index; | |
} else { | |
this._state = (!this._xmlMode && (c === "s" || c === "S")) ? | |
BEFORE_SPECIAL : IN_TAG_NAME; | |
this._sectionStart = this._index; | |
} | |
}; | |
Tokenizer.prototype._stateInTagName = function(c){ | |
if(c === "/" || c === ">" || whitespace(c)){ | |
this._emitToken("onopentagname"); | |
this._state = BEFORE_ATTRIBUTE_NAME; | |
this._index--; | |
} | |
}; | |
Tokenizer.prototype._stateBeforeCloseingTagName = function(c){ | |
if(whitespace(c)); | |
else if(c === ">"){ | |
this._state = TEXT; | |
} else if(this._special !== SPECIAL_NONE){ | |
if(c === "s" || c === "S"){ | |
this._state = BEFORE_SPECIAL_END; | |
} else { | |
this._state = TEXT; | |
this._index--; | |
} | |
} else { | |
this._state = IN_CLOSING_TAG_NAME; | |
this._sectionStart = this._index; | |
} | |
}; | |
Tokenizer.prototype._stateInCloseingTagName = function(c){ | |
if(c === ">" || whitespace(c)){ | |
this._emitToken("onclosetag"); | |
this._state = AFTER_CLOSING_TAG_NAME; | |
this._index--; | |
} | |
}; | |
Tokenizer.prototype._stateAfterCloseingTagName = function(c){ | |
//skip everything until ">" | |
if(c === ">"){ | |
this._state = TEXT; | |
this._sectionStart = this._index + 1; | |
} | |
}; | |
Tokenizer.prototype._stateBeforeAttributeName = function(c){ | |
if(c === ">"){ | |
this._cbs.onopentagend(); | |
this._state = TEXT; | |
this._sectionStart = this._index + 1; | |
} else if(c === "/"){ | |
this._state = IN_SELF_CLOSING_TAG; | |
} else if(!whitespace(c)){ | |
this._state = IN_ATTRIBUTE_NAME; | |
this._sectionStart = this._index; | |
} | |
}; | |
Tokenizer.prototype._stateInSelfClosingTag = function(c){ | |
if(c === ">"){ | |
this._cbs.onselfclosingtag(); | |
this._state = TEXT; | |
this._sectionStart = this._index + 1; | |
} else if(!whitespace(c)){ | |
this._state = BEFORE_ATTRIBUTE_NAME; | |
this._index--; | |
} | |
}; | |
Tokenizer.prototype._stateInAttributeName = function(c){ | |
if(c === "=" || c === "/" || c === ">" || whitespace(c)){ | |
this._cbs.onattribname(this._getSection()); | |
this._sectionStart = -1; | |
this._state = AFTER_ATTRIBUTE_NAME; | |
this._index--; | |
} | |
}; | |
Tokenizer.prototype._stateAfterAttributeName = function(c){ | |
if(c === "="){ | |
this._state = BEFORE_ATTRIBUTE_VALUE; | |
} else if(c === "/" || c === ">"){ | |
this._cbs.onattribend(); | |
this._state = BEFORE_ATTRIBUTE_NAME; | |
this._index--; | |
} else if(!whitespace(c)){ | |
this._cbs.onattribend(); | |
this._state = IN_ATTRIBUTE_NAME; | |
this._sectionStart = this._index; | |
} | |
}; | |
Tokenizer.prototype._stateBeforeAttributeValue = function(c){ | |
if(c === "\""){ | |
this._state = IN_ATTRIBUTE_VALUE_DQ; | |
this._sectionStart = this._index + 1; | |
} else if(c === "'"){ | |
this._state = IN_ATTRIBUTE_VALUE_SQ; | |
this._sectionStart = this._index + 1; | |
} else if(!whitespace(c)){ | |
this._state = IN_ATTRIBUTE_VALUE_NQ; | |
this._sectionStart = this._index; | |
this._index--; //reconsume token | |
} | |
}; | |
Tokenizer.prototype._stateInAttributeValueDoubleQuotes = function(c){ | |
if(c === "\""){ | |
this._emitToken("onattribdata"); | |
this._cbs.onattribend(); | |
this._state = BEFORE_ATTRIBUTE_NAME; | |
} else if(this._decodeEntities && c === "&"){ | |
this._emitToken("onattribdata"); | |
this._baseState = this._state; | |
this._state = BEFORE_ENTITY; | |
this._sectionStart = this._index; | |
} | |
}; | |
Tokenizer.prototype._stateInAttributeValueSingleQuotes = function(c){ | |
if(c === "'"){ | |
this._emitToken("onattribdata"); | |
this._cbs.onattribend(); | |
this._state = BEFORE_ATTRIBUTE_NAME; | |
} else if(this._decodeEntities && c === "&"){ | |
this._emitToken("onattribdata"); | |
this._baseState = this._state; | |
this._state = BEFORE_ENTITY; | |
this._sectionStart = this._index; | |
} | |
}; | |
Tokenizer.prototype._stateInAttributeValueNoQuotes = function(c){ | |
if(whitespace(c) || c === ">"){ | |
this._emitToken("onattribdata"); | |
this._cbs.onattribend(); | |
this._state = BEFORE_ATTRIBUTE_NAME; | |
this._index--; | |
} else if(this._decodeEntities && c === "&"){ | |
this._emitToken("onattribdata"); | |
this._baseState = this._state; | |
this._state = BEFORE_ENTITY; | |
this._sectionStart = this._index; | |
} | |
}; | |
Tokenizer.prototype._stateBeforeDeclaration = function(c){ | |
this._state = c === "[" ? BEFORE_CDATA_1 : | |
c === "-" ? BEFORE_COMMENT : | |
IN_DECLARATION; | |
}; | |
Tokenizer.prototype._stateInDeclaration = function(c){ | |
if(c === ">"){ | |
this._cbs.ondeclaration(this._getSection()); | |
this._state = TEXT; | |
this._sectionStart = this._index + 1; | |
} | |
}; | |
Tokenizer.prototype._stateInProcessingInstruction = function(c){ | |
if(c === ">"){ | |
this._cbs.onprocessinginstruction(this._getSection()); | |
this._state = TEXT; | |
this._sectionStart = this._index + 1; | |
} | |
}; | |
Tokenizer.prototype._stateBeforeComment = function(c){ | |
if(c === "-"){ | |
this._state = IN_COMMENT; | |
this._sectionStart = this._index + 1; | |
} else { | |
this._state = IN_DECLARATION; | |
} | |
}; | |
Tokenizer.prototype._stateInComment = function(c){ | |
if(c === "-") this._state = AFTER_COMMENT_1; | |
}; | |
Tokenizer.prototype._stateAfterComment1 = function(c){ | |
if(c === "-"){ | |
this._state = AFTER_COMMENT_2; | |
} else { | |
this._state = IN_COMMENT; | |
} | |
}; | |
Tokenizer.prototype._stateAfterComment2 = function(c){ | |
if(c === ">"){ | |
//remove 2 trailing chars | |
this._cbs.oncomment(this._buffer.substring(this._sectionStart, this._index - 2)); | |
this._state = TEXT; | |
this._sectionStart = this._index + 1; | |
} else if(c !== "-"){ | |
this._state = IN_COMMENT; | |
} | |
// else: stay in AFTER_COMMENT_2 (`--->`) | |
}; | |
Tokenizer.prototype._stateBeforeCdata1 = ifElseState("C", BEFORE_CDATA_2, IN_DECLARATION); | |
Tokenizer.prototype._stateBeforeCdata2 = ifElseState("D", BEFORE_CDATA_3, IN_DECLARATION); | |
Tokenizer.prototype._stateBeforeCdata3 = ifElseState("A", BEFORE_CDATA_4, IN_DECLARATION); | |
Tokenizer.prototype._stateBeforeCdata4 = ifElseState("T", BEFORE_CDATA_5, IN_DECLARATION); | |
Tokenizer.prototype._stateBeforeCdata5 = ifElseState("A", BEFORE_CDATA_6, IN_DECLARATION); | |
Tokenizer.prototype._stateBeforeCdata6 = function(c){ | |
if(c === "["){ | |
this._state = IN_CDATA; | |
this._sectionStart = this._index + 1; | |
} else { | |
this._state = IN_DECLARATION; | |
this._index--; | |
} | |
}; | |
Tokenizer.prototype._stateInCdata = function(c){ | |
if(c === "]") this._state = AFTER_CDATA_1; | |
}; | |
Tokenizer.prototype._stateAfterCdata1 = characterState("]", AFTER_CDATA_2); | |
Tokenizer.prototype._stateAfterCdata2 = function(c){ | |
if(c === ">"){ | |
//remove 2 trailing chars | |
this._cbs.oncdata(this._buffer.substring(this._sectionStart, this._index - 2)); | |
this._state = TEXT; | |
this._sectionStart = this._index + 1; | |
} else if (c !== "]") { | |
this._state = IN_CDATA; | |
} | |
//else: stay in AFTER_CDATA_2 (`]]]>`) | |
}; | |
Tokenizer.prototype._stateBeforeSpecial = function(c){ | |
if(c === "c" || c === "C"){ | |
this._state = BEFORE_SCRIPT_1; | |
} else if(c === "t" || c === "T"){ | |
this._state = BEFORE_STYLE_1; | |
} else { | |
this._state = IN_TAG_NAME; | |
this._index--; //consume the token again | |
} | |
}; | |
Tokenizer.prototype._stateBeforeSpecialEnd = function(c){ | |
if(this._special === SPECIAL_SCRIPT && (c === "c" || c === "C")){ | |
this._state = AFTER_SCRIPT_1; | |
} else if(this._special === SPECIAL_STYLE && (c === "t" || c === "T")){ | |
this._state = AFTER_STYLE_1; | |
} | |
else this._state = TEXT; | |
}; | |
Tokenizer.prototype._stateBeforeScript1 = consumeSpecialNameChar("R", BEFORE_SCRIPT_2); | |
Tokenizer.prototype._stateBeforeScript2 = consumeSpecialNameChar("I", BEFORE_SCRIPT_3); | |
Tokenizer.prototype._stateBeforeScript3 = consumeSpecialNameChar("P", BEFORE_SCRIPT_4); | |
Tokenizer.prototype._stateBeforeScript4 = consumeSpecialNameChar("T", BEFORE_SCRIPT_5); | |
Tokenizer.prototype._stateBeforeScript5 = function(c){ | |
if(c === "/" || c === ">" || whitespace(c)){ | |
this._special = SPECIAL_SCRIPT; | |
} | |
this._state = IN_TAG_NAME; | |
this._index--; //consume the token again | |
}; | |
Tokenizer.prototype._stateAfterScript1 = ifElseState("R", AFTER_SCRIPT_2, TEXT); | |
Tokenizer.prototype._stateAfterScript2 = ifElseState("I", AFTER_SCRIPT_3, TEXT); | |
Tokenizer.prototype._stateAfterScript3 = ifElseState("P", AFTER_SCRIPT_4, TEXT); | |
Tokenizer.prototype._stateAfterScript4 = ifElseState("T", AFTER_SCRIPT_5, TEXT); | |
Tokenizer.prototype._stateAfterScript5 = function(c){ | |
if(c === ">" || whitespace(c)){ | |
this._special = SPECIAL_NONE; | |
this._state = IN_CLOSING_TAG_NAME; | |
this._sectionStart = this._index - 6; | |
this._index--; //reconsume the token | |
} | |
else this._state = TEXT; | |
}; | |
Tokenizer.prototype._stateBeforeStyle1 = consumeSpecialNameChar("Y", BEFORE_STYLE_2); | |
Tokenizer.prototype._stateBeforeStyle2 = consumeSpecialNameChar("L", BEFORE_STYLE_3); | |
Tokenizer.prototype._stateBeforeStyle3 = consumeSpecialNameChar("E", BEFORE_STYLE_4); | |
Tokenizer.prototype._stateBeforeStyle4 = function(c){ | |
if(c === "/" || c === ">" || whitespace(c)){ | |
this._special = SPECIAL_STYLE; | |
} | |
this._state = IN_TAG_NAME; | |
this._index--; //consume the token again | |
}; | |
Tokenizer.prototype._stateAfterStyle1 = ifElseState("Y", AFTER_STYLE_2, TEXT); | |
Tokenizer.prototype._stateAfterStyle2 = ifElseState("L", AFTER_STYLE_3, TEXT); | |
Tokenizer.prototype._stateAfterStyle3 = ifElseState("E", AFTER_STYLE_4, TEXT); | |
Tokenizer.prototype._stateAfterStyle4 = function(c){ | |
if(c === ">" || whitespace(c)){ | |
this._special = SPECIAL_NONE; | |
this._state = IN_CLOSING_TAG_NAME; | |
this._sectionStart = this._index - 5; | |
this._index--; //reconsume the token | |
} | |
else this._state = TEXT; | |
}; | |
Tokenizer.prototype._stateBeforeEntity = ifElseState("#", BEFORE_NUMERIC_ENTITY, IN_NAMED_ENTITY); | |
Tokenizer.prototype._stateBeforeNumericEntity = ifElseState("X", IN_HEX_ENTITY, IN_NUMERIC_ENTITY); | |
//for entities terminated with a semicolon | |
Tokenizer.prototype._parseNamedEntityStrict = function(){ | |
//offset = 1 | |
if(this._sectionStart + 1 < this._index){ | |
var entity = this._buffer.substring(this._sectionStart + 1, this._index), | |
map = this._xmlMode ? xmlMap : entityMap; | |
if(map.hasOwnProperty(entity)){ | |
this._emitPartial(map[entity]); | |
this._sectionStart = this._index + 1; | |
} | |
} | |
}; | |
//parses legacy entities (without trailing semicolon) | |
Tokenizer.prototype._parseLegacyEntity = function(){ | |
var start = this._sectionStart + 1, | |
limit = this._index - start; | |
if(limit > 6) limit = 6; //the max length of legacy entities is 6 | |
while(limit >= 2){ //the min length of legacy entities is 2 | |
var entity = this._buffer.substr(start, limit); | |
if(legacyMap.hasOwnProperty(entity)){ | |
this._emitPartial(legacyMap[entity]); | |
this._sectionStart += limit + 1; | |
return; | |
} else { | |
limit--; | |
} | |
} | |
}; | |
Tokenizer.prototype._stateInNamedEntity = function(c){ | |
if(c === ";"){ | |
this._parseNamedEntityStrict(); | |
if(this._sectionStart + 1 < this._index && !this._xmlMode){ | |
this._parseLegacyEntity(); | |
} | |
this._state = this._baseState; | |
} else if((c < "a" || c > "z") && (c < "A" || c > "Z") && (c < "0" || c > "9")){ | |
if(this._xmlMode); | |
else if(this._sectionStart + 1 === this._index); | |
else if(this._baseState !== TEXT){ | |
if(c !== "="){ | |
this._parseNamedEntityStrict(); | |
} | |
} else { | |
this._parseLegacyEntity(); | |
} | |
this._state = this._baseState; | |
this._index--; | |
} | |
}; | |
Tokenizer.prototype._decodeNumericEntity = function(offset, base){ | |
var sectionStart = this._sectionStart + offset; | |
if(sectionStart !== this._index){ | |
//parse entity | |
var entity = this._buffer.substring(sectionStart, this._index); | |
var parsed = parseInt(entity, base); | |
this._emitPartial(decodeCodePoint(parsed)); | |
this._sectionStart = this._index; | |
} else { | |
this._sectionStart--; | |
} | |
this._state = this._baseState; | |
}; | |
Tokenizer.prototype._stateInNumericEntity = function(c){ | |
if(c === ";"){ | |
this._decodeNumericEntity(2, 10); | |
this._sectionStart++; | |
} else if(c < "0" || c > "9"){ | |
if(!this._xmlMode){ | |
this._decodeNumericEntity(2, 10); | |
} else { | |
this._state = this._baseState; | |
} | |
this._index--; | |
} | |
}; | |
Tokenizer.prototype._stateInHexEntity = function(c){ | |
if(c === ";"){ | |
this._decodeNumericEntity(3, 16); | |
this._sectionStart++; | |
} else if((c < "a" || c > "f") && (c < "A" || c > "F") && (c < "0" || c > "9")){ | |
if(!this._xmlMode){ | |
this._decodeNumericEntity(3, 16); | |
} else { | |
this._state = this._baseState; | |
} | |
this._index--; | |
} | |
}; | |
Tokenizer.prototype._cleanup = function () { | |
if(this._sectionStart < 0){ | |
this._buffer = ""; | |
this._index = 0; | |
} else if(this._running){ | |
if(this._state === TEXT){ | |
if(this._sectionStart !== this._index){ | |
this._cbs.ontext(this._buffer.substr(this._sectionStart)); | |
} | |
this._buffer = ""; | |
this._index = 0; | |
} else if(this._sectionStart === this._index){ | |
//the section just started | |
this._buffer = ""; | |
this._index = 0; | |
} else { | |
//remove everything unnecessary | |
this._buffer = this._buffer.substr(this._sectionStart); | |
this._index -= this._sectionStart; | |
} | |
this._sectionStart = 0; | |
} | |
}; | |
//TODO make events conditional | |
Tokenizer.prototype.write = function(chunk){ | |
if(this._ended) this._cbs.onerror(Error(".write() after done!")); | |
this._buffer += chunk; | |
this._parse(); | |
}; | |
Tokenizer.prototype._parse = function(){ | |
while(this._index < this._buffer.length && this._running){ | |
var c = this._buffer.charAt(this._index); | |
if(this._state === TEXT) { | |
this._stateText(c); | |
} else if(this._state === BEFORE_TAG_NAME){ | |
this._stateBeforeTagName(c); | |
} else if(this._state === IN_TAG_NAME) { | |
this._stateInTagName(c); | |
} else if(this._state === BEFORE_CLOSING_TAG_NAME){ | |
this._stateBeforeCloseingTagName(c); | |
} else if(this._state === IN_CLOSING_TAG_NAME){ | |
this._stateInCloseingTagName(c); | |
} else if(this._state === AFTER_CLOSING_TAG_NAME){ | |
this._stateAfterCloseingTagName(c); | |
} else if(this._state === IN_SELF_CLOSING_TAG){ | |
this._stateInSelfClosingTag(c); | |
} | |
/* | |
* attributes | |
*/ | |
else if(this._state === BEFORE_ATTRIBUTE_NAME){ | |
this._stateBeforeAttributeName(c); | |
} else if(this._state === IN_ATTRIBUTE_NAME){ | |
this._stateInAttributeName(c); | |
} else if(this._state === AFTER_ATTRIBUTE_NAME){ | |
this._stateAfterAttributeName(c); | |
} else if(this._state === BEFORE_ATTRIBUTE_VALUE){ | |
this._stateBeforeAttributeValue(c); | |
} else if(this._state === IN_ATTRIBUTE_VALUE_DQ){ | |
this._stateInAttributeValueDoubleQuotes(c); | |
} else if(this._state === IN_ATTRIBUTE_VALUE_SQ){ | |
this._stateInAttributeValueSingleQuotes(c); | |
} else if(this._state === IN_ATTRIBUTE_VALUE_NQ){ | |
this._stateInAttributeValueNoQuotes(c); | |
} | |
/* | |
* declarations | |
*/ | |
else if(this._state === BEFORE_DECLARATION){ | |
this._stateBeforeDeclaration(c); | |
} else if(this._state === IN_DECLARATION){ | |
this._stateInDeclaration(c); | |
} | |
/* | |
* processing instructions | |
*/ | |
else if(this._state === IN_PROCESSING_INSTRUCTION){ | |
this._stateInProcessingInstruction(c); | |
} | |
/* | |
* comments | |
*/ | |
else if(this._state === BEFORE_COMMENT){ | |
this._stateBeforeComment(c); | |
} else if(this._state === IN_COMMENT){ | |
this._stateInComment(c); | |
} else if(this._state === AFTER_COMMENT_1){ | |
this._stateAfterComment1(c); | |
} else if(this._state === AFTER_COMMENT_2){ | |
this._stateAfterComment2(c); | |
} | |
/* | |
* cdata | |
*/ | |
else if(this._state === BEFORE_CDATA_1){ | |
this._stateBeforeCdata1(c); | |
} else if(this._state === BEFORE_CDATA_2){ | |
this._stateBeforeCdata2(c); | |
} else if(this._state === BEFORE_CDATA_3){ | |
this._stateBeforeCdata3(c); | |
} else if(this._state === BEFORE_CDATA_4){ | |
this._stateBeforeCdata4(c); | |
} else if(this._state === BEFORE_CDATA_5){ | |
this._stateBeforeCdata5(c); | |
} else if(this._state === BEFORE_CDATA_6){ | |
this._stateBeforeCdata6(c); | |
} else if(this._state === IN_CDATA){ | |
this._stateInCdata(c); | |
} else if(this._state === AFTER_CDATA_1){ | |
this._stateAfterCdata1(c); | |
} else if(this._state === AFTER_CDATA_2){ | |
this._stateAfterCdata2(c); | |
} | |
/* | |
* special tags | |
*/ | |
else if(this._state === BEFORE_SPECIAL){ | |
this._stateBeforeSpecial(c); | |
} else if(this._state === BEFORE_SPECIAL_END){ | |
this._stateBeforeSpecialEnd(c); | |
} | |
/* | |
* script | |
*/ | |
else if(this._state === BEFORE_SCRIPT_1){ | |
this._stateBeforeScript1(c); | |
} else if(this._state === BEFORE_SCRIPT_2){ | |
this._stateBeforeScript2(c); | |
} else if(this._state === BEFORE_SCRIPT_3){ | |
this._stateBeforeScript3(c); | |
} else if(this._state === BEFORE_SCRIPT_4){ | |
this._stateBeforeScript4(c); | |
} else if(this._state === BEFORE_SCRIPT_5){ | |
this._stateBeforeScript5(c); | |
} | |
else if(this._state === AFTER_SCRIPT_1){ | |
this._stateAfterScript1(c); | |
} else if(this._state === AFTER_SCRIPT_2){ | |
this._stateAfterScript2(c); | |
} else if(this._state === AFTER_SCRIPT_3){ | |
this._stateAfterScript3(c); | |
} else if(this._state === AFTER_SCRIPT_4){ | |
this._stateAfterScript4(c); | |
} else if(this._state === AFTER_SCRIPT_5){ | |
this._stateAfterScript5(c); | |
} | |
/* | |
* style | |
*/ | |
else if(this._state === BEFORE_STYLE_1){ | |
this._stateBeforeStyle1(c); | |
} else if(this._state === BEFORE_STYLE_2){ | |
this._stateBeforeStyle2(c); | |
} else if(this._state === BEFORE_STYLE_3){ | |
this._stateBeforeStyle3(c); | |
} else if(this._state === BEFORE_STYLE_4){ | |
this._stateBeforeStyle4(c); | |
} | |
else if(this._state === AFTER_STYLE_1){ | |
this._stateAfterStyle1(c); | |
} else if(this._state === AFTER_STYLE_2){ | |
this._stateAfterStyle2(c); | |
} else if(this._state === AFTER_STYLE_3){ | |
this._stateAfterStyle3(c); | |
} else if(this._state === AFTER_STYLE_4){ | |
this._stateAfterStyle4(c); | |
} | |
/* | |
* entities | |
*/ | |
else if(this._state === BEFORE_ENTITY){ | |
this._stateBeforeEntity(c); | |
} else if(this._state === BEFORE_NUMERIC_ENTITY){ | |
this._stateBeforeNumericEntity(c); | |
} else if(this._state === IN_NAMED_ENTITY){ | |
this._stateInNamedEntity(c); | |
} else if(this._state === IN_NUMERIC_ENTITY){ | |
this._stateInNumericEntity(c); | |
} else if(this._state === IN_HEX_ENTITY){ | |
this._stateInHexEntity(c); | |
} | |
else { | |
this._cbs.onerror(Error("unknown _state"), this._state); | |
} | |
this._index++; | |
} | |
this._cleanup(); | |
}; | |
Tokenizer.prototype.pause = function(){ | |
this._running = false; | |
}; | |
Tokenizer.prototype.resume = function(){ | |
this._running = true; | |
if(this._index < this._buffer.length){ | |
this._parse(); | |
} | |
if(this._ended){ | |
this._finish(); | |
} | |
}; | |
Tokenizer.prototype.end = function(chunk){ | |
if(this._ended) this._cbs.onerror(Error(".end() after done!")); | |
if(chunk) this.write(chunk); | |
this._ended = true; | |
if(this._running) this._finish(); | |
}; | |
Tokenizer.prototype._finish = function(){ | |
//if there is remaining data, emit it in a reasonable way | |
if(this._sectionStart < this._index){ | |
this._handleTrailingData(); | |
} | |
this._cbs.onend(); | |
}; | |
Tokenizer.prototype._handleTrailingData = function(){ | |
var data = this._buffer.substr(this._sectionStart); | |
if(this._state === IN_CDATA || this._state === AFTER_CDATA_1 || this._state === AFTER_CDATA_2){ | |
this._cbs.oncdata(data); | |
} else if(this._state === IN_COMMENT || this._state === AFTER_COMMENT_1 || this._state === AFTER_COMMENT_2){ | |
this._cbs.oncomment(data); | |
} else if(this._state === IN_NAMED_ENTITY && !this._xmlMode){ | |
this._parseLegacyEntity(); | |
if(this._sectionStart < this._index){ | |
this._state = this._baseState; | |
this._handleTrailingData(); | |
} | |
} else if(this._state === IN_NUMERIC_ENTITY && !this._xmlMode){ | |
this._decodeNumericEntity(2, 10); | |
if(this._sectionStart < this._index){ | |
this._state = this._baseState; | |
this._handleTrailingData(); | |
} | |
} else if(this._state === IN_HEX_ENTITY && !this._xmlMode){ | |
this._decodeNumericEntity(3, 16); | |
if(this._sectionStart < this._index){ | |
this._state = this._baseState; | |
this._handleTrailingData(); | |
} | |
} else if( | |
this._state !== IN_TAG_NAME && | |
this._state !== BEFORE_ATTRIBUTE_NAME && | |
this._state !== BEFORE_ATTRIBUTE_VALUE && | |
this._state !== AFTER_ATTRIBUTE_NAME && | |
this._state !== IN_ATTRIBUTE_NAME && | |
this._state !== IN_ATTRIBUTE_VALUE_SQ && | |
this._state !== IN_ATTRIBUTE_VALUE_DQ && | |
this._state !== IN_ATTRIBUTE_VALUE_NQ && | |
this._state !== IN_CLOSING_TAG_NAME | |
){ | |
this._cbs.ontext(data); | |
} | |
//else, ignore remaining data | |
//TODO add a way to remove current tag | |
}; | |
Tokenizer.prototype.reset = function(){ | |
Tokenizer.call(this, {xmlMode: this._xmlMode, decodeEntities: this._decodeEntities}, this._cbs); | |
}; | |
Tokenizer.prototype._getSection = function(){ | |
return this._buffer.substring(this._sectionStart, this._index); | |
}; | |
Tokenizer.prototype._emitToken = function(name){ | |
this._cbs[name](this._getSection()); | |
this._sectionStart = -1; | |
}; | |
Tokenizer.prototype._emitPartial = function(value){ | |
if(this._baseState !== TEXT){ | |
this._cbs.onattribdata(value); //TODO implement the new event | |
} else { | |
this._cbs.ontext(value); | |
} | |
}; | |
/***/ }, | |
/* 74 */ | |
/*!**************************************************!*\ | |
!*** ./~/jsdom/~/htmlparser2/lib/FeedHandler.js ***! | |
\**************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var index = __webpack_require__(/*! ./index.js */ 45), | |
DomHandler = index.DomHandler, | |
DomUtils = index.DomUtils; | |
//TODO: make this a streamable handler | |
function FeedHandler(callback, options){ | |
this.init(callback, options); | |
} | |
__webpack_require__(/*! util */ 87).inherits(FeedHandler, DomHandler); | |
FeedHandler.prototype.init = DomHandler; | |
function getElements(what, where){ | |
return DomUtils.getElementsByTagName(what, where, true); | |
} | |
function getOneElement(what, where){ | |
return DomUtils.getElementsByTagName(what, where, true, 1)[0]; | |
} | |
function fetch(what, where, recurse){ | |
return DomUtils.getText( | |
DomUtils.getElementsByTagName(what, where, recurse, 1) | |
).trim(); | |
} | |
function addConditionally(obj, prop, what, where, recurse){ | |
var tmp = fetch(what, where, recurse); | |
if(tmp) obj[prop] = tmp; | |
} | |
var isValidFeed = function(value) { | |
return value === "rss" || value === "feed" || value === "rdf:RDF"; | |
}; | |
FeedHandler.prototype.onend = function() { | |
var feed = {}, | |
feedRoot = getOneElement(isValidFeed, this.dom), | |
tmp, childs; | |
if(feedRoot){ | |
if(feedRoot.name === "feed"){ | |
childs = feedRoot.children; | |
feed.type = "atom"; | |
addConditionally(feed, "id", "id", childs); | |
addConditionally(feed, "title", "title", childs); | |
if((tmp = getOneElement("link", childs)) && (tmp = tmp.attribs) && (tmp = tmp.href)) feed.link = tmp; | |
addConditionally(feed, "description", "subtitle", childs); | |
if((tmp = fetch("updated", childs))) feed.updated = new Date(tmp); | |
addConditionally(feed, "author", "email", childs, true); | |
feed.items = getElements("entry", childs).map(function(item){ | |
var entry = {}, tmp; | |
item = item.children; | |
addConditionally(entry, "id", "id", item); | |
addConditionally(entry, "title", "title", item); | |
if((tmp = getOneElement("link", item)) && (tmp = tmp.attribs) && (tmp = tmp.href)) entry.link = tmp; | |
addConditionally(entry, "description", "summary", item); | |
if((tmp = fetch("updated", item))) entry.pubDate = new Date(tmp); | |
return entry; | |
}); | |
} else { | |
childs = getOneElement("channel", feedRoot.children).children; | |
feed.type = feedRoot.name.substr(0, 3); | |
feed.id = ""; | |
addConditionally(feed, "title", "title", childs); | |
addConditionally(feed, "link", "link", childs); | |
addConditionally(feed, "description", "description", childs); | |
if((tmp = fetch("lastBuildDate", childs))) feed.updated = new Date(tmp); | |
addConditionally(feed, "author", "managingEditor", childs, true); | |
feed.items = getElements("item", feedRoot.children).map(function(item){ | |
var entry = {}, tmp; | |
item = item.children; | |
addConditionally(entry, "id", "guid", item); | |
addConditionally(entry, "title", "title", item); | |
addConditionally(entry, "link", "link", item); | |
addConditionally(entry, "description", "description", item); | |
if((tmp = fetch("pubDate", item))) entry.pubDate = new Date(tmp); | |
return entry; | |
}); | |
} | |
} | |
this.dom = feed; | |
DomHandler.prototype._handleCallback.call( | |
this, feedRoot ? null : Error("couldn't find root of feed") | |
); | |
}; | |
module.exports = FeedHandler; | |
/***/ }, | |
/* 75 */ | |
/*!*********************************************!*\ | |
!*** ./~/jsdom/~/htmlparser2/lib/Stream.js ***! | |
\*********************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
module.exports = Stream; | |
var Parser = __webpack_require__(/*! ./WritableStream.js */ 76); | |
function Stream(options){ | |
Parser.call(this, new Cbs(this), options); | |
} | |
__webpack_require__(/*! util */ 87).inherits(Stream, Parser); | |
Stream.prototype.readable = true; | |
function Cbs(scope){ | |
this.scope = scope; | |
} | |
var EVENTS = __webpack_require__(/*! ../ */ 45).EVENTS; | |
Object.keys(EVENTS).forEach(function(name){ | |
if(EVENTS[name] === 0){ | |
Cbs.prototype["on" + name] = function(){ | |
this.scope.emit(name); | |
}; | |
} else if(EVENTS[name] === 1){ | |
Cbs.prototype["on" + name] = function(a){ | |
this.scope.emit(name, a); | |
}; | |
} else if(EVENTS[name] === 2){ | |
Cbs.prototype["on" + name] = function(a, b){ | |
this.scope.emit(name, a, b); | |
}; | |
} else { | |
throw Error("wrong number of arguments!"); | |
} | |
}); | |
/***/ }, | |
/* 76 */ | |
/*!*****************************************************!*\ | |
!*** ./~/jsdom/~/htmlparser2/lib/WritableStream.js ***! | |
\*****************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
module.exports = Stream; | |
var Parser = __webpack_require__(/*! ./Parser.js */ 72), | |
WritableStream = __webpack_require__(/*! stream */ 95).Writable || __webpack_require__(/*! readable-stream */ 97).Writable; | |
function Stream(cbs, options){ | |
var parser = this._parser = new Parser(cbs, options); | |
WritableStream.call(this, {decodeStrings: false}); | |
this.once("finish", function(){ | |
parser.end(); | |
}); | |
} | |
__webpack_require__(/*! util */ 87).inherits(Stream, WritableStream); | |
WritableStream.prototype._write = function(chunk, encoding, cb){ | |
this._parser.write(chunk); | |
cb(); | |
}; | |
/***/ }, | |
/* 77 */ | |
/*!***************************************************!*\ | |
!*** ./~/jsdom/~/htmlparser2/lib/ProxyHandler.js ***! | |
\***************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
module.exports = ProxyHandler; | |
function ProxyHandler(cbs){ | |
this._cbs = cbs || {}; | |
} | |
var EVENTS = __webpack_require__(/*! ./ */ 45).EVENTS; | |
Object.keys(EVENTS).forEach(function(name){ | |
if(EVENTS[name] === 0){ | |
name = "on" + name; | |
ProxyHandler.prototype[name] = function(){ | |
if(this._cbs[name]) this._cbs[name](); | |
}; | |
} else if(EVENTS[name] === 1){ | |
name = "on" + name; | |
ProxyHandler.prototype[name] = function(a){ | |
if(this._cbs[name]) this._cbs[name](a); | |
}; | |
} else if(EVENTS[name] === 2){ | |
name = "on" + name; | |
ProxyHandler.prototype[name] = function(a, b){ | |
if(this._cbs[name]) this._cbs[name](a, b); | |
}; | |
} else { | |
throw Error("wrong number of arguments"); | |
} | |
}); | |
/***/ }, | |
/* 78 */ | |
/*!********************************************************!*\ | |
!*** ./~/jsdom/~/htmlparser2/lib/CollectingHandler.js ***! | |
\********************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
module.exports = CollectingHandler; | |
function CollectingHandler(cbs){ | |
this._cbs = cbs || {}; | |
this.events = []; | |
} | |
var EVENTS = __webpack_require__(/*! ./ */ 45).EVENTS; | |
Object.keys(EVENTS).forEach(function(name){ | |
if(EVENTS[name] === 0){ | |
name = "on" + name; | |
CollectingHandler.prototype[name] = function(){ | |
this.events.push([name]); | |
if(this._cbs[name]) this._cbs[name](); | |
}; | |
} else if(EVENTS[name] === 1){ | |
name = "on" + name; | |
CollectingHandler.prototype[name] = function(a){ | |
this.events.push([name, a]); | |
if(this._cbs[name]) this._cbs[name](a); | |
}; | |
} else if(EVENTS[name] === 2){ | |
name = "on" + name; | |
CollectingHandler.prototype[name] = function(a, b){ | |
this.events.push([name, a, b]); | |
if(this._cbs[name]) this._cbs[name](a, b); | |
}; | |
} else { | |
throw Error("wrong number of arguments"); | |
} | |
}); | |
CollectingHandler.prototype.onreset = function(){ | |
this.events = []; | |
if(this._cbs.onreset) this._cbs.onreset(); | |
}; | |
CollectingHandler.prototype.restart = function(){ | |
if(this._cbs.onreset) this._cbs.onreset(); | |
for(var i = 0, len = this.events.length; i < len; i++){ | |
if(this._cbs[this.events[i][0]]){ | |
var num = this.events[i].length; | |
if(num === 1){ | |
this._cbs[this.events[i][0]](); | |
} else if(num === 2){ | |
this._cbs[this.events[i][0]](this.events[i][1]); | |
} else { | |
this._cbs[this.events[i][0]](this.events[i][1], this.events[i][2]); | |
} | |
} | |
} | |
}; | |
/***/ }, | |
/* 79 */ | |
/*!**********************************************************************!*\ | |
!*** ./~/jsdom/~/parse5/lib/tree_construction/open_element_stack.js ***! | |
\**********************************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var HTML = __webpack_require__(/*! ../common/html */ 86); | |
//Aliases | |
var $ = HTML.TAG_NAMES, | |
NS = HTML.NAMESPACES; | |
//Element utils | |
//OPTIMIZATION: Integer comparisons are low-cost, so we can use very fast tag name length filters here. | |
//It's faster than using dictionary. | |
function isImpliedEndTagRequired(tn) { | |
switch (tn.length) { | |
case 1: | |
return tn === $.P; | |
case 2: | |
return tn === $.RP || tn === $.RT || tn === $.DD || tn === $.DT || tn === $.LI; | |
case 6: | |
return tn === $.OPTION; | |
case 8: | |
return tn === $.OPTGROUP; | |
} | |
return false; | |
} | |
function isScopingElement(tn, ns) { | |
switch (tn.length) { | |
case 2: | |
if (tn === $.TD || tn === $.TH) | |
return ns === NS.HTML; | |
else if (tn === $.MI || tn === $.MO || tn == $.MN || tn === $.MS) | |
return ns === NS.MATHML; | |
break; | |
case 4: | |
if (tn === $.HTML) | |
return ns === NS.HTML; | |
else if (tn === $.DESC) | |
return ns === NS.SVG; | |
break; | |
case 5: | |
if (tn === $.TABLE) | |
return ns === NS.HTML; | |
else if (tn === $.MTEXT) | |
return ns === NS.MATHML; | |
else if (tn === $.TITLE) | |
return ns === NS.SVG; | |
break; | |
case 6: | |
return (tn === $.APPLET || tn === $.OBJECT) && ns === NS.HTML; | |
case 7: | |
return (tn === $.CAPTION || tn === $.MARQUEE) && ns === NS.HTML; | |
case 13: | |
return tn === $.FOREIGN_OBJECT && ns === NS.SVG; | |
case 14: | |
return tn === $.ANNOTATION_XML && ns === NS.MATHML; | |
} | |
return false; | |
} | |
//Stack of open elements | |
var OpenElementStack = module.exports = function (document, treeAdapter) { | |
this.stackTop = -1; | |
this.items = []; | |
this.current = document; | |
this.currentTagName = null; | |
this.treeAdapter = treeAdapter; | |
}; | |
//Index of element | |
OpenElementStack.prototype._indexOf = function (element) { | |
var idx = -1; | |
for (var i = this.stackTop; i >= 0; i--) { | |
if (this.items[i] === element) { | |
idx = i; | |
break; | |
} | |
} | |
return idx; | |
}; | |
//Update current element | |
OpenElementStack.prototype._updateCurrentElement = function () { | |
this.current = this.items[this.stackTop]; | |
this.currentTagName = this.current && this.treeAdapter.getTagName(this.current); | |
}; | |
//Mutations | |
OpenElementStack.prototype.push = function (element) { | |
this.items[++this.stackTop] = element; | |
this._updateCurrentElement(); | |
}; | |
OpenElementStack.prototype.pop = function () { | |
this.stackTop--; | |
this._updateCurrentElement(); | |
}; | |
OpenElementStack.prototype.replace = function (oldElement, newElement) { | |
var idx = this._indexOf(oldElement); | |
this.items[idx] = newElement; | |
if (idx === this.stackTop) | |
this._updateCurrentElement(); | |
}; | |
OpenElementStack.prototype.insertAfter = function (referenceElement, newElement) { | |
var insertionIdx = this._indexOf(referenceElement) + 1; | |
this.items.splice(insertionIdx, 0, newElement); | |
if (insertionIdx == ++this.stackTop) | |
this._updateCurrentElement(); | |
}; | |
OpenElementStack.prototype.popUntilTagNamePopped = function (tagName) { | |
while (this.stackTop > -1) { | |
var tn = this.currentTagName; | |
this.pop(); | |
if (tn === tagName) | |
break; | |
} | |
}; | |
OpenElementStack.prototype.popUntilElementPopped = function (element) { | |
while (this.stackTop > -1) { | |
var poppedElement = this.current; | |
this.pop(); | |
if (poppedElement === element) | |
break; | |
} | |
}; | |
OpenElementStack.prototype.popUntilNumberedHeaderPopped = function () { | |
while (this.stackTop > -1) { | |
var tn = this.currentTagName; | |
this.pop(); | |
if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) | |
break; | |
} | |
}; | |
OpenElementStack.prototype.popAllUpToHtmlElement = function () { | |
//NOTE: here we assume that root <html> element is always first in the open element stack, so | |
//we perform this fast stack clean up. | |
this.stackTop = 0; | |
this._updateCurrentElement(); | |
}; | |
OpenElementStack.prototype.clearBackToTableContext = function () { | |
while (this.currentTagName !== $.TABLE && this.currentTagName !== $.HTML) | |
this.pop(); | |
}; | |
OpenElementStack.prototype.clearBackToTableBodyContext = function () { | |
while (this.currentTagName !== $.TBODY && this.currentTagName !== $.TFOOT && | |
this.currentTagName !== $.THEAD && this.currentTagName !== $.HTML) { | |
this.pop(); | |
} | |
}; | |
OpenElementStack.prototype.clearBackToTableRowContext = function () { | |
while (this.currentTagName !== $.TR && this.currentTagName !== $.HTML) | |
this.pop(); | |
}; | |
OpenElementStack.prototype.remove = function (element) { | |
for (var i = this.stackTop; i >= 0; i--) { | |
if (this.items[i] === element) { | |
this.items.splice(i, 1); | |
this.stackTop--; | |
this._updateCurrentElement(); | |
break; | |
} | |
} | |
}; | |
//Search | |
OpenElementStack.prototype.tryPeekProperlyNestedBodyElement = function () { | |
//Properly nested <body> element (should be second element in stack). | |
var element = this.items[1]; | |
return element && this.treeAdapter.getTagName(element) === $.BODY ? element : null; | |
}; | |
OpenElementStack.prototype.contains = function (element) { | |
return this._indexOf(element) > -1; | |
}; | |
OpenElementStack.prototype.getCommonAncestor = function (element) { | |
var elementIdx = this._indexOf(element); | |
return --elementIdx >= 0 ? this.items[elementIdx] : null; | |
}; | |
OpenElementStack.prototype.isRootHtmlElementCurrent = function () { | |
return this.stackTop === 0 && this.currentTagName === $.HTML; | |
}; | |
//Element in scope | |
OpenElementStack.prototype.hasInScope = function (tagName) { | |
for (var i = this.stackTop; i >= 0; i--) { | |
var tn = this.treeAdapter.getTagName(this.items[i]); | |
if (tn === tagName) | |
return true; | |
var ns = this.treeAdapter.getNamespaceURI(this.items[i]); | |
if (isScopingElement(tn, ns)) | |
return false; | |
} | |
return true; | |
}; | |
OpenElementStack.prototype.hasNumberedHeaderInScope = function () { | |
for (var i = this.stackTop; i >= 0; i--) { | |
var tn = this.treeAdapter.getTagName(this.items[i]); | |
if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) | |
return true; | |
if (isScopingElement(tn, this.treeAdapter.getNamespaceURI(this.items[i]))) | |
return false; | |
} | |
return true; | |
}; | |
OpenElementStack.prototype.hasInListItemScope = function (tagName) { | |
for (var i = this.stackTop; i >= 0; i--) { | |
var tn = this.treeAdapter.getTagName(this.items[i]); | |
if (tn === tagName) | |
return true; | |
var ns = this.treeAdapter.getNamespaceURI(this.items[i]); | |
if (((tn === $.UL || tn === $.OL) && ns === NS.HTML) || isScopingElement(tn, ns)) | |
return false; | |
} | |
return true; | |
}; | |
OpenElementStack.prototype.hasInButtonScope = function (tagName) { | |
for (var i = this.stackTop; i >= 0; i--) { | |
var tn = this.treeAdapter.getTagName(this.items[i]); | |
if (tn === tagName) | |
return true; | |
var ns = this.treeAdapter.getNamespaceURI(this.items[i]); | |
if ((tn === $.BUTTON && ns === NS.HTML) || isScopingElement(tn, ns)) | |
return false; | |
} | |
return true; | |
}; | |
OpenElementStack.prototype.hasInTableScope = function (tagName) { | |
for (var i = this.stackTop; i >= 0; i--) { | |
var tn = this.treeAdapter.getTagName(this.items[i]); | |
if (tn === tagName) | |
return true; | |
var ns = this.treeAdapter.getNamespaceURI(this.items[i]); | |
if ((tn === $.TABLE || tn === $.HTML) && ns === NS.HTML) | |
return false; | |
} | |
return true; | |
}; | |
OpenElementStack.prototype.hasTableBodyContextInTableScope = function () { | |
for (var i = this.stackTop; i >= 0; i--) { | |
var tn = this.treeAdapter.getTagName(this.items[i]); | |
if (tn === $.TBODY || tn === $.THEAD || tn === $.TFOOT) | |
return true; | |
var ns = this.treeAdapter.getNamespaceURI(this.items[i]); | |
if ((tn === $.TABLE || tn === $.HTML) && ns === NS.HTML) | |
return false; | |
} | |
return true; | |
}; | |
OpenElementStack.prototype.hasInSelectScope = function (tagName) { | |
for (var i = this.stackTop; i >= 0; i--) { | |
var tn = this.treeAdapter.getTagName(this.items[i]); | |
if (tn === tagName) | |
return true; | |
var ns = this.treeAdapter.getNamespaceURI(this.items[i]); | |
if (tn !== $.OPTION && tn !== $.OPTGROUP && ns === NS.HTML) | |
return false; | |
} | |
return true; | |
}; | |
//Implied end tags | |
OpenElementStack.prototype.generateImpliedEndTags = function () { | |
while (isImpliedEndTagRequired(this.currentTagName)) | |
this.pop(); | |
}; | |
OpenElementStack.prototype.generateImpliedEndTagsWithExclusion = function (exclusionTagName) { | |
while (isImpliedEndTagRequired(this.currentTagName) && this.currentTagName !== exclusionTagName) | |
this.pop(); | |
}; | |
/***/ }, | |
/* 80 */ | |
/*!***************************************************************************!*\ | |
!*** ./~/jsdom/~/parse5/lib/tree_construction/formatting_element_list.js ***! | |
\***************************************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//Const | |
var NOAH_ARK_CAPACITY = 3; | |
//List of formatting elements | |
var FormattingElementList = module.exports = function (treeAdapter) { | |
this.length = 0; | |
this.entries = []; | |
this.treeAdapter = treeAdapter; | |
this.bookmark = null; | |
}; | |
//Entry types | |
FormattingElementList.MARKER_ENTRY = 'MARKER_ENTRY'; | |
FormattingElementList.ELEMENT_ENTRY = 'ELEMENT_ENTRY'; | |
//Noah Ark's condition | |
//OPTIMIZATION: at first we try to find possible candidates for exclusion using | |
//lightweight heuristics without thorough attributes check. | |
FormattingElementList.prototype._getNoahArkConditionCandidates = function (newElement) { | |
var candidates = []; | |
if (this.length >= NOAH_ARK_CAPACITY) { | |
var neAttrsLength = this.treeAdapter.getAttrList(newElement).length, | |
neTagName = this.treeAdapter.getTagName(newElement), | |
neNamespaceURI = this.treeAdapter.getNamespaceURI(newElement); | |
for (var i = this.length - 1; i >= 0; i--) { | |
var entry = this.entries[i]; | |
if (entry.type === FormattingElementList.MARKER_ENTRY) | |
break; | |
var element = entry.element, | |
elementAttrs = this.treeAdapter.getAttrList(element); | |
if (this.treeAdapter.getTagName(element) === neTagName && | |
this.treeAdapter.getNamespaceURI(element) === neNamespaceURI && | |
elementAttrs.length === neAttrsLength) { | |
candidates.push({idx: i, attrs: elementAttrs}); | |
} | |
} | |
} | |
return candidates.length < NOAH_ARK_CAPACITY ? [] : candidates; | |
}; | |
FormattingElementList.prototype._ensureNoahArkCondition = function (newElement) { | |
var candidates = this._getNoahArkConditionCandidates(newElement), | |
cLength = candidates.length; | |
if (cLength) { | |
var neAttrs = this.treeAdapter.getAttrList(newElement), | |
neAttrsLength = neAttrs.length, | |
neAttrsMap = {}; | |
//NOTE: build attrs map for the new element so we can perform fast lookups | |
for (var i = 0; i < neAttrsLength; i++) { | |
var neAttr = neAttrs[i]; | |
neAttrsMap[neAttr.name] = neAttr.value; | |
} | |
for (var i = 0; i < neAttrsLength; i++) { | |
for (var j = 0; j < cLength; j++) { | |
var cAttr = candidates[j].attrs[i]; | |
if (neAttrsMap[cAttr.name] !== cAttr.value) { | |
candidates.splice(j, 1); | |
cLength--; | |
} | |
if (candidates.length < NOAH_ARK_CAPACITY) | |
return; | |
} | |
} | |
//NOTE: remove bottommost candidates until Noah's Ark condition will not be met | |
for (var i = cLength - 1; i >= NOAH_ARK_CAPACITY - 1; i--) { | |
this.entries.splice(candidates[i].idx, 1); | |
this.length--; | |
} | |
} | |
}; | |
//Mutations | |
FormattingElementList.prototype.insertMarker = function () { | |
this.entries.push({type: FormattingElementList.MARKER_ENTRY}); | |
this.length++; | |
}; | |
FormattingElementList.prototype.pushElement = function (element, token) { | |
this._ensureNoahArkCondition(element); | |
this.entries.push({ | |
type: FormattingElementList.ELEMENT_ENTRY, | |
element: element, | |
token: token | |
}); | |
this.length++; | |
}; | |
FormattingElementList.prototype.insertElementAfterBookmark = function (element, token) { | |
var bookmarkIdx = this.length - 1; | |
for (; bookmarkIdx >= 0; bookmarkIdx--) { | |
if (this.entries[bookmarkIdx] === this.bookmark) | |
break; | |
} | |
this.entries.splice(bookmarkIdx + 1, 0, { | |
type: FormattingElementList.ELEMENT_ENTRY, | |
element: element, | |
token: token | |
}); | |
this.length++; | |
}; | |
FormattingElementList.prototype.removeEntry = function (entry) { | |
for (var i = this.length - 1; i >= 0; i--) { | |
if (this.entries[i] === entry) { | |
this.entries.splice(i, 1); | |
this.length--; | |
break; | |
} | |
} | |
}; | |
FormattingElementList.prototype.clearToLastMarker = function () { | |
while (this.length) { | |
var entry = this.entries.pop(); | |
this.length--; | |
if (entry.type === FormattingElementList.MARKER_ENTRY) | |
break; | |
} | |
}; | |
//Search | |
FormattingElementList.prototype.getElementEntryInScopeWithTagName = function (tagName) { | |
for (var i = this.length - 1; i >= 0; i--) { | |
var entry = this.entries[i]; | |
if (entry.type === FormattingElementList.MARKER_ENTRY) | |
return null; | |
if (this.treeAdapter.getTagName(entry.element) === tagName) | |
return entry; | |
} | |
return null; | |
}; | |
FormattingElementList.prototype.getElementEntry = function (element) { | |
for (var i = this.length - 1; i >= 0; i--) { | |
var entry = this.entries[i]; | |
if (entry.type === FormattingElementList.ELEMENT_ENTRY && entry.element == element) | |
return entry; | |
} | |
return null; | |
}; | |
/***/ }, | |
/* 81 */ | |
/*!***********************************************************!*\ | |
!*** ./~/jsdom/~/parse5/lib/tree_construction/doctype.js ***! | |
\***********************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//Const | |
var VALID_DOCTYPE_NAME = 'html', | |
QUIRKS_MODE_SYSTEM_ID = 'http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd', | |
QUIRKS_MODE_PUBLIC_ID_PREFIXES = [ | |
"+//silmaril//dtd html pro v0r11 19970101//en", | |
"-//advasoft ltd//dtd html 3.0 aswedit + extensions//en", | |
"-//as//dtd html 3.0 aswedit + extensions//en", | |
"-//ietf//dtd html 2.0 level 1//en", | |
"-//ietf//dtd html 2.0 level 2//en", | |
"-//ietf//dtd html 2.0 strict level 1//en", | |
"-//ietf//dtd html 2.0 strict level 2//en", | |
"-//ietf//dtd html 2.0 strict//en", | |
"-//ietf//dtd html 2.0//en", | |
"-//ietf//dtd html 2.1e//en", | |
"-//ietf//dtd html 3.0//en", | |
"-//ietf//dtd html 3.0//en//", | |
"-//ietf//dtd html 3.2 final//en", | |
"-//ietf//dtd html 3.2//en", | |
"-//ietf//dtd html 3//en", | |
"-//ietf//dtd html level 0//en", | |
"-//ietf//dtd html level 0//en//2.0", | |
"-//ietf//dtd html level 1//en", | |
"-//ietf//dtd html level 1//en//2.0", | |
"-//ietf//dtd html level 2//en", | |
"-//ietf//dtd html level 2//en//2.0", | |
"-//ietf//dtd html level 3//en", | |
"-//ietf//dtd html level 3//en//3.0", | |
"-//ietf//dtd html strict level 0//en", | |
"-//ietf//dtd html strict level 0//en//2.0", | |
"-//ietf//dtd html strict level 1//en", | |
"-//ietf//dtd html strict level 1//en//2.0", | |
"-//ietf//dtd html strict level 2//en", | |
"-//ietf//dtd html strict level 2//en//2.0", | |
"-//ietf//dtd html strict level 3//en", | |
"-//ietf//dtd html strict level 3//en//3.0", | |
"-//ietf//dtd html strict//en", | |
"-//ietf//dtd html strict//en//2.0", | |
"-//ietf//dtd html strict//en//3.0", | |
"-//ietf//dtd html//en", | |
"-//ietf//dtd html//en//2.0", | |
"-//ietf//dtd html//en//3.0", | |
"-//metrius//dtd metrius presentational//en", | |
"-//microsoft//dtd internet explorer 2.0 html strict//en", | |
"-//microsoft//dtd internet explorer 2.0 html//en", | |
"-//microsoft//dtd internet explorer 2.0 tables//en", | |
"-//microsoft//dtd internet explorer 3.0 html strict//en", | |
"-//microsoft//dtd internet explorer 3.0 html//en", | |
"-//microsoft//dtd internet explorer 3.0 tables//en", | |
"-//netscape comm. corp.//dtd html//en", | |
"-//netscape comm. corp.//dtd strict html//en", | |
"-//o'reilly and associates//dtd html 2.0//en", | |
"-//o'reilly and associates//dtd html extended 1.0//en", | |
"-//spyglass//dtd html 2.0 extended//en", | |
"-//sq//dtd html 2.0 hotmetal + extensions//en", | |
"-//sun microsystems corp.//dtd hotjava html//en", | |
"-//sun microsystems corp.//dtd hotjava strict html//en", | |
"-//w3c//dtd html 3 1995-03-24//en", | |
"-//w3c//dtd html 3.2 draft//en", | |
"-//w3c//dtd html 3.2 final//en", | |
"-//w3c//dtd html 3.2//en", | |
"-//w3c//dtd html 3.2s draft//en", | |
"-//w3c//dtd html 4.0 frameset//en", | |
"-//w3c//dtd html 4.0 transitional//en", | |
"-//w3c//dtd html experimental 19960712//en", | |
"-//w3c//dtd html experimental 970421//en", | |
"-//w3c//dtd w3 html//en", | |
"-//w3o//dtd w3 html 3.0//en", | |
"-//w3o//dtd w3 html 3.0//en//", | |
"-//webtechs//dtd mozilla html 2.0//en", | |
"-//webtechs//dtd mozilla html//en" | |
], | |
QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES = [ | |
'-//w3c//dtd html 4.01 frameset//', | |
'-//w3c//dtd html 4.01 transitional//' | |
], | |
QUIRKS_MODE_PUBLIC_IDS = [ | |
'-//w3o//dtd w3 html strict 3.0//en//', | |
'-/w3c/dtd html 4.0 transitional/en', | |
'html' | |
]; | |
exports.isQuirks = function (name, publicId, systemId) { | |
if (name !== VALID_DOCTYPE_NAME) | |
return true; | |
if (systemId && systemId.toLowerCase() === QUIRKS_MODE_SYSTEM_ID) | |
return true; | |
if (publicId !== null) { | |
publicId = publicId.toLowerCase(); | |
if (QUIRKS_MODE_PUBLIC_IDS.indexOf(publicId) > -1) | |
return true; | |
var prefixes = QUIRKS_MODE_PUBLIC_ID_PREFIXES; | |
if (systemId === null) | |
prefixes = prefixes.concat(QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES); | |
for (var i = 0; i < prefixes.length; i++) { | |
if (publicId.indexOf(prefixes[i]) === 0) | |
return true; | |
} | |
} | |
return false; | |
}; | |
/***/ }, | |
/* 82 */ | |
/*!************************************************************!*\ | |
!*** ./~/jsdom/~/parse5/lib/simple_api/tokenizer_proxy.js ***! | |
\************************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var Tokenizer = __webpack_require__(/*! ../tokenization/tokenizer */ 83), | |
ForeignContent = __webpack_require__(/*! ../common/foreign_content */ 84), | |
UNICODE = __webpack_require__(/*! ../common/unicode */ 85), | |
HTML = __webpack_require__(/*! ../common/html */ 86); | |
//Aliases | |
var $ = HTML.TAG_NAMES, | |
NS = HTML.NAMESPACES; | |
//Tokenizer proxy | |
//NOTE: this proxy simulates adjustment of the Tokenizer which performed by standard parser during tree construction. | |
var TokenizerProxy = module.exports = function (html) { | |
this.tokenizer = new Tokenizer(html); | |
this.namespaceStack = []; | |
this.namespaceStackTop = -1; | |
this.currentNamespace = null; | |
this.inForeignContent = false; | |
}; | |
//API | |
TokenizerProxy.prototype.getNextToken = function () { | |
var token = this.tokenizer.getNextToken(); | |
if (token.type === Tokenizer.START_TAG_TOKEN) | |
this._handleStartTagToken(token); | |
else if (token.type === Tokenizer.END_TAG_TOKEN) | |
this._handleEndTagToken(token); | |
else if (token.type === Tokenizer.NULL_CHARACTER_TOKEN && this.inForeignContent) { | |
token.type = Tokenizer.CHARACTER_TOKEN; | |
token.chars = UNICODE.REPLACEMENT_CHARACTER; | |
} | |
return token; | |
}; | |
//Namespace stack mutations | |
TokenizerProxy.prototype._enterNamespace = function (namespace) { | |
this.namespaceStackTop++; | |
this.namespaceStack.push(namespace); | |
this.inForeignContent = namespace !== NS.HTML; | |
this.currentNamespace = namespace; | |
this.tokenizer.allowCDATA = this.inForeignContent; | |
}; | |
TokenizerProxy.prototype._leaveCurrentNamespace = function () { | |
this.namespaceStackTop--; | |
this.namespaceStack.pop(); | |
this.currentNamespace = this.namespaceStack[this.namespaceStackTop]; | |
this.inForeignContent = this.currentNamespace !== NS.HTML; | |
this.tokenizer.allowCDATA = this.inForeignContent; | |
}; | |
//Token handlers | |
TokenizerProxy.prototype._ensureTokenizerState = function (tn) { | |
if (tn === $.TEXTAREA || tn === $.TITLE) | |
this.tokenizer.state = Tokenizer.RCDATA_STATE; | |
else if (tn === $.PLAINTEXT) | |
this.tokenizer.state = Tokenizer.PLAINTEXT_STATE; | |
else if (tn === $.SCRIPT) | |
this.tokenizer.state = Tokenizer.SCRIPT_DATA_STATE; | |
else if (tn === $.STYLE || tn === $.IFRAME || tn === $.XMP || | |
tn === $.NOEMBED || tn === $.NOFRAMES || tn === $.NOSCRIPT) { | |
this.tokenizer.state = Tokenizer.RAWTEXT_STATE; | |
} | |
}; | |
TokenizerProxy.prototype._handleStartTagToken = function (token) { | |
var tn = token.tagName; | |
if (tn === $.SVG) | |
this._enterNamespace(NS.SVG); | |
else if (tn === $.MATH) | |
this._enterNamespace(NS.MATHML); | |
else { | |
if (this.inForeignContent) { | |
if (ForeignContent.causesExit(token)) | |
this._leaveCurrentNamespace(); | |
else if (ForeignContent.isMathMLTextIntegrationPoint(tn, this.currentNamespace) || | |
ForeignContent.isHtmlIntegrationPoint(tn, this.currentNamespace, token.attrs)) { | |
this._enterNamespace(NS.HTML); | |
} | |
} | |
else | |
this._ensureTokenizerState(tn); | |
} | |
}; | |
TokenizerProxy.prototype._handleEndTagToken = function (token) { | |
var tn = token.tagName; | |
if (!this.inForeignContent) { | |
var previousNs = this.namespaceStack[this.namespaceStackTop - 1]; | |
//NOTE: check for exit from integration point | |
if (ForeignContent.isMathMLTextIntegrationPoint(tn, previousNs) || | |
ForeignContent.isHtmlIntegrationPoint(tn, previousNs, token.attrs)) { | |
this._leaveCurrentNamespace(); | |
} | |
else if (tn === $.SCRIPT) | |
this.tokenizer.state = Tokenizer.DATA_STATE; | |
} | |
else if ((tn === $.SVG && this.currentNamespace === NS.SVG) || (tn === $.MATH && this.currentNamespace === NS.MATHML)) | |
this._leaveCurrentNamespace(); | |
}; | |
/***/ }, | |
/* 83 */ | |
/*!********************************************************!*\ | |
!*** ./~/jsdom/~/parse5/lib/tokenization/tokenizer.js ***! | |
\********************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var Preprocessor = __webpack_require__(/*! ./preprocessor */ 92), | |
UNICODE = __webpack_require__(/*! ../common/unicode */ 85), | |
NAMED_ENTITY_TRIE = __webpack_require__(/*! ./named_entity_trie */ 93); | |
//Aliases | |
var $ = UNICODE.CODE_POINTS, | |
$$ = UNICODE.CODE_POINT_SEQUENCES; | |
//Replacement code points for numeric entities | |
var NUMERIC_ENTITY_REPLACEMENTS = { | |
0x00: 0xFFFD, 0x0D: 0x000D, 0x80: 0x20AC, 0x81: 0x0081, 0x82: 0x201A, 0x83: 0x0192, 0x84: 0x201E, | |
0x85: 0x2026, 0x86: 0x2020, 0x87: 0x2021, 0x88: 0x02C6, 0x89: 0x2030, 0x8A: 0x0160, 0x8B: 0x2039, | |
0x8C: 0x0152, 0x8D: 0x008D, 0x8E: 0x017D, 0x8F: 0x008F, 0x90: 0x0090, 0x91: 0x2018, 0x92: 0x2019, | |
0x93: 0x201C, 0x94: 0x201D, 0x95: 0x2022, 0x96: 0x2013, 0x97: 0x2014, 0x98: 0x02DC, 0x99: 0x2122, | |
0x9A: 0x0161, 0x9B: 0x203A, 0x9C: 0x0153, 0x9D: 0x009D, 0x9E: 0x017E, 0x9F: 0x0178 | |
}; | |
//States | |
var DATA_STATE = 'DATA_STATE', | |
CHARACTER_REFERENCE_IN_DATA_STATE = 'CHARACTER_REFERENCE_IN_DATA_STATE', | |
RCDATA_STATE = 'RCDATA_STATE', | |
CHARACTER_REFERENCE_IN_RCDATA_STATE = 'CHARACTER_REFERENCE_IN_RCDATA_STATE', | |
RAWTEXT_STATE = 'RAWTEXT_STATE', | |
SCRIPT_DATA_STATE = 'SCRIPT_DATA_STATE', | |
PLAINTEXT_STATE = 'PLAINTEXT_STATE', | |
TAG_OPEN_STATE = 'TAG_OPEN_STATE', | |
END_TAG_OPEN_STATE = 'END_TAG_OPEN_STATE', | |
TAG_NAME_STATE = 'TAG_NAME_STATE', | |
RCDATA_LESS_THAN_SIGN_STATE = 'RCDATA_LESS_THAN_SIGN_STATE', | |
RCDATA_END_TAG_OPEN_STATE = 'RCDATA_END_TAG_OPEN_STATE', | |
RCDATA_END_TAG_NAME_STATE = 'RCDATA_END_TAG_NAME_STATE', | |
RAWTEXT_LESS_THAN_SIGN_STATE = 'RAWTEXT_LESS_THAN_SIGN_STATE', | |
RAWTEXT_END_TAG_OPEN_STATE = 'RAWTEXT_END_TAG_OPEN_STATE', | |
RAWTEXT_END_TAG_NAME_STATE = 'RAWTEXT_END_TAG_NAME_STATE', | |
SCRIPT_DATA_LESS_THAN_SIGN_STATE = 'SCRIPT_DATA_LESS_THAN_SIGN_STATE', | |
SCRIPT_DATA_END_TAG_OPEN_STATE = 'SCRIPT_DATA_END_TAG_OPEN_STATE', | |
SCRIPT_DATA_END_TAG_NAME_STATE = 'SCRIPT_DATA_END_TAG_NAME_STATE', | |
SCRIPT_DATA_ESCAPE_START_STATE = 'SCRIPT_DATA_ESCAPE_START_STATE', | |
SCRIPT_DATA_ESCAPE_START_DASH_STATE = 'SCRIPT_DATA_ESCAPE_START_DASH_STATE', | |
SCRIPT_DATA_ESCAPED_STATE = 'SCRIPT_DATA_ESCAPED_STATE', | |
SCRIPT_DATA_ESCAPED_DASH_STATE = 'SCRIPT_DATA_ESCAPED_DASH_STATE', | |
SCRIPT_DATA_ESCAPED_DASH_DASH_STATE = 'SCRIPT_DATA_ESCAPED_DASH_DASH_STATE', | |
SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE = 'SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE', | |
SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE = 'SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE', | |
SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE = 'SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE', | |
SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE', | |
SCRIPT_DATA_DOUBLE_ESCAPED_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPED_STATE', | |
SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE', | |
SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE', | |
SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE', | |
SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE', | |
BEFORE_ATTRIBUTE_NAME_STATE = 'BEFORE_ATTRIBUTE_NAME_STATE', | |
ATTRIBUTE_NAME_STATE = 'ATTRIBUTE_NAME_STATE', | |
AFTER_ATTRIBUTE_NAME_STATE = 'AFTER_ATTRIBUTE_NAME_STATE', | |
BEFORE_ATTRIBUTE_VALUE_STATE = 'BEFORE_ATTRIBUTE_VALUE_STATE', | |
ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE = 'ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE', | |
ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE = 'ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE', | |
ATTRIBUTE_VALUE_UNQUOTED_STATE = 'ATTRIBUTE_VALUE_UNQUOTED_STATE', | |
CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE_STATE = 'CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE_STATE', | |
AFTER_ATTRIBUTE_VALUE_QUOTED_STATE = 'AFTER_ATTRIBUTE_VALUE_QUOTED_STATE', | |
SELF_CLOSING_START_TAG_STATE = 'SELF_CLOSING_START_TAG_STATE', | |
BOGUS_COMMENT_STATE = 'BOGUS_COMMENT_STATE', | |
MARKUP_DECLARATION_OPEN_STATE = 'MARKUP_DECLARATION_OPEN_STATE', | |
COMMENT_START_STATE = 'COMMENT_START_STATE', | |
COMMENT_START_DASH_STATE = 'COMMENT_START_DASH_STATE', | |
COMMENT_STATE = 'COMMENT_STATE', | |
COMMENT_END_DASH_STATE = 'COMMENT_END_DASH_STATE', | |
COMMENT_END_STATE = 'COMMENT_END_STATE', | |
COMMENT_END_BANG_STATE = 'COMMENT_END_BANG_STATE', | |
DOCTYPE_STATE = 'DOCTYPE_STATE', | |
BEFORE_DOCTYPE_NAME_STATE = 'BEFORE_DOCTYPE_NAME_STATE', | |
DOCTYPE_NAME_STATE = 'DOCTYPE_NAME_STATE', | |
AFTER_DOCTYPE_NAME_STATE = 'AFTER_DOCTYPE_NAME_STATE', | |
AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE = 'AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE', | |
BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE = 'BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE', | |
DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE = 'DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE', | |
DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE = 'DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE', | |
AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE = 'AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE', | |
BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE = 'BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE', | |
AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE = 'AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE', | |
BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE = 'BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE', | |
DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE = 'DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE', | |
DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE = 'DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE', | |
AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE = 'AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE', | |
BOGUS_DOCTYPE_STATE = 'BOGUS_DOCTYPE_STATE', | |
CDATA_SECTION_STATE = 'CDATA_SECTION_STATE'; | |
//Utils | |
//OPTIMIZATION: these utility functions should not be moved out of this module. V8 Crankshaft will not inline | |
//this functions if they will be situated in another module due to context switch. | |
//Always perform inlining check before modifying this functions ('node --trace-inlining'). | |
function isWhitespace(cp) { | |
return cp === $.SPACE || cp === $.LINE_FEED || cp === $.TABULATION || cp === $.FORM_FEED; | |
} | |
function isAsciiDigit(cp) { | |
return cp >= $.DIGIT_0 && cp <= $.DIGIT_9; | |
} | |
function isAsciiUpper(cp) { | |
return cp >= $.LATIN_CAPITAL_A && cp <= $.LATIN_CAPITAL_Z; | |
} | |
function isAsciiLower(cp) { | |
return cp >= $.LATIN_SMALL_A && cp <= $.LATIN_SMALL_Z; | |
} | |
function isAsciiAlphaNumeric(cp) { | |
return isAsciiDigit(cp) || isAsciiUpper(cp) || isAsciiLower(cp); | |
} | |
function isDigit(cp, isHex) { | |
return isAsciiDigit(cp) || (isHex && ((cp >= $.LATIN_CAPITAL_A && cp <= $.LATIN_CAPITAL_F) || | |
(cp >= $.LATIN_SMALL_A && cp <= $.LATIN_SMALL_F))); | |
} | |
function isReservedCodePoint(cp) { | |
return cp >= 0xD800 && cp <= 0xDFFF || cp > 0x10FFFF; | |
} | |
function toAsciiLowerCodePoint(cp) { | |
return cp + 0x0020; | |
} | |
//NOTE: String.fromCharCode() function can handle only characters from BMP subset. | |
//So, we need to workaround this manually. | |
//(see: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/fromCharCode#Getting_it_to_work_with_higher_values) | |
function toChar(cp) { | |
if (cp <= 0xFFFF) | |
return String.fromCharCode(cp); | |
cp -= 0x10000; | |
return String.fromCharCode(cp >>> 10 & 0x3FF | 0xD800) + String.fromCharCode(0xDC00 | cp & 0x3FF); | |
} | |
function toAsciiLowerChar(cp) { | |
return String.fromCharCode(toAsciiLowerCodePoint(cp)); | |
} | |
//Tokenizer | |
var Tokenizer = module.exports = function (html) { | |
this.preprocessor = new Preprocessor(html); | |
this.tokenQueue = []; | |
this.allowCDATA = false; | |
this.state = DATA_STATE; | |
this.returnState = ''; | |
this.consumptionPos = 0; | |
this.tempBuff = []; | |
this.additionalAllowedCp = $.UNDEFINED; | |
this.lastStartTagName = ''; | |
this.currentCharacterToken = null; | |
this.currentToken = null; | |
this.currentAttr = null; | |
}; | |
//Token types | |
Tokenizer.CHARACTER_TOKEN = 'CHARACTER_TOKEN'; | |
Tokenizer.NULL_CHARACTER_TOKEN = 'NULL_CHARACTER_TOKEN'; | |
Tokenizer.WHITESPACE_CHARACTER_TOKEN = 'WHITESPACE_CHARACTER_TOKEN'; | |
Tokenizer.START_TAG_TOKEN = 'START_TAG_TOKEN'; | |
Tokenizer.END_TAG_TOKEN = 'END_TAG_TOKEN'; | |
Tokenizer.COMMENT_TOKEN = 'COMMENT_TOKEN'; | |
Tokenizer.DOCTYPE_TOKEN = 'DOCTYPE_TOKEN'; | |
Tokenizer.EOF_TOKEN = 'EOF_TOKEN'; | |
//States export | |
Tokenizer.DATA_STATE = DATA_STATE; | |
Tokenizer.RCDATA_STATE = RCDATA_STATE; | |
Tokenizer.RAWTEXT_STATE = RAWTEXT_STATE; | |
Tokenizer.SCRIPT_DATA_STATE = SCRIPT_DATA_STATE; | |
Tokenizer.PLAINTEXT_STATE = PLAINTEXT_STATE; | |
//Static | |
Tokenizer.getTokenAttr = function (token, attrName) { | |
for (var i = token.attrs.length - 1; i >= 0; i--) { | |
if (token.attrs[i].name === attrName) | |
return token.attrs[i].value; | |
} | |
return null; | |
}; | |
//Get token | |
Tokenizer.prototype.getNextToken = function () { | |
while (!this.tokenQueue.length) | |
this[this.state](this._consume()); | |
return this.tokenQueue.shift(); | |
}; | |
//Consumption | |
Tokenizer.prototype._consume = function () { | |
this.consumptionPos++; | |
return this.preprocessor.advanceAndPeekCodePoint(); | |
}; | |
Tokenizer.prototype._unconsume = function () { | |
this.consumptionPos--; | |
this.preprocessor.retreat(); | |
}; | |
Tokenizer.prototype._unconsumeSeveral = function (count) { | |
while (count--) | |
this._unconsume(); | |
}; | |
Tokenizer.prototype._reconsumeInState = function (state) { | |
this.state = state; | |
this._unconsume(); | |
}; | |
Tokenizer.prototype._consumeSubsequentIfMatch = function (pattern, startCp, caseSensitive) { | |
var rollbackPos = this.consumptionPos, | |
isMatch = true, | |
patternLength = pattern.length, | |
patternPos = 0, | |
cp = startCp, | |
patternCp = $.UNDEFINED; | |
for (; patternPos < patternLength; patternPos++) { | |
if (patternPos > 0) | |
cp = this._consume(); | |
if (cp === $.EOF) { | |
isMatch = false; | |
break; | |
} | |
patternCp = pattern[patternPos]; | |
if (cp !== patternCp && (caseSensitive || cp !== toAsciiLowerCodePoint(patternCp))) { | |
isMatch = false; | |
break; | |
} | |
} | |
if (!isMatch) | |
this._unconsumeSeveral(this.consumptionPos - rollbackPos); | |
return isMatch; | |
}; | |
//Lookahead | |
Tokenizer.prototype._lookahead = function () { | |
var cp = this.preprocessor.advanceAndPeekCodePoint(); | |
this.preprocessor.retreat(); | |
return cp; | |
}; | |
//Temp buffer | |
Tokenizer.prototype.isTempBufferEqualToScriptString = function () { | |
if (this.tempBuff.length !== $$.SCRIPT_STRING.length) | |
return false; | |
for (var i = 0; i < this.tempBuff.length; i++) { | |
if (this.tempBuff[i] !== $$.SCRIPT_STRING[i]) | |
return false; | |
} | |
return true; | |
}; | |
//Token creation | |
Tokenizer.prototype.buildStartTagToken = function (tagName) { | |
return { | |
type: Tokenizer.START_TAG_TOKEN, | |
tagName: tagName, | |
selfClosing: false, | |
attrs: [] | |
}; | |
}; | |
Tokenizer.prototype.buildEndTagToken = function (tagName) { | |
return { | |
type: Tokenizer.END_TAG_TOKEN, | |
tagName: tagName, | |
ignored: false, | |
attrs: [] | |
}; | |
}; | |
Tokenizer.prototype._createStartTagToken = function (tagNameFirstCh) { | |
this.currentToken = this.buildStartTagToken(tagNameFirstCh); | |
}; | |
Tokenizer.prototype._createEndTagToken = function (tagNameFirstCh) { | |
this.currentToken = this.buildEndTagToken(tagNameFirstCh); | |
}; | |
Tokenizer.prototype._createCommentToken = function () { | |
this.currentToken = { | |
type: Tokenizer.COMMENT_TOKEN, | |
data: '' | |
}; | |
}; | |
Tokenizer.prototype._createDoctypeToken = function (doctypeNameFirstCh) { | |
this.currentToken = { | |
type: Tokenizer.DOCTYPE_TOKEN, | |
name: doctypeNameFirstCh || '', | |
forceQuirks: false, | |
publicId: null, | |
systemId: null | |
}; | |
}; | |
//Tag attributes | |
Tokenizer.prototype._createAttr = function (attrNameFirstCh) { | |
this.currentAttr = { | |
name: attrNameFirstCh, | |
value: '' | |
}; | |
}; | |
Tokenizer.prototype._isDuplicateAttr = function () { | |
return Tokenizer.getTokenAttr(this.currentToken, this.currentAttr.name) !== null; | |
}; | |
Tokenizer.prototype._leaveAttrName = function (toState) { | |
this.state = toState; | |
if (!this._isDuplicateAttr()) | |
this.currentToken.attrs.push(this.currentAttr); | |
}; | |
//Appropriate end tag token | |
//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#appropriate-end-tag-token) | |
Tokenizer.prototype._isAppropriateEndTagToken = function () { | |
return this.lastStartTagName === this.currentToken.tagName; | |
}; | |
//Token emission | |
Tokenizer.prototype._emitCurrentToken = function () { | |
this._emitCurrentCharacterToken(); | |
//NOTE: store emited start tag's tagName to determine is the following end tag token is appropriate. | |
if (this.currentToken.type === Tokenizer.START_TAG_TOKEN) | |
this.lastStartTagName = this.currentToken.tagName; | |
this.tokenQueue.push(this.currentToken); | |
this.currentToken = null; | |
}; | |
Tokenizer.prototype._emitCurrentCharacterToken = function () { | |
if (this.currentCharacterToken) { | |
this.tokenQueue.push(this.currentCharacterToken); | |
this.currentCharacterToken = null; | |
} | |
}; | |
Tokenizer.prototype._emitEOFToken = function () { | |
this._emitCurrentCharacterToken(); | |
this.tokenQueue.push({type: Tokenizer.EOF_TOKEN}); | |
}; | |
//Characters emission | |
//OPTIMIZATION: specification uses only one type of character tokens (one token per character). | |
//This causes a huge memory overhead and a lot of unnecessary parser loops. parse5 uses 3 groups of characters. | |
//If we have a sequence of characters that belong to the same group, parser can process it | |
//as a single solid character token. | |
//So, there are 3 types of character tokens in parse5: | |
//1)NULL_CHARACTER_TOKEN - \u0000-character sequences (e.g. '\u0000\u0000\u0000') | |
//2)WHITESPACE_CHARACTER_TOKEN - any whitespace/new-line character sequences (e.g. '\n \r\t \f') | |
//3)CHARACTER_TOKEN - any character sequence which don't belong to groups 1 and 2 (e.g. 'abcdef1234@@#$%^') | |
Tokenizer.prototype._appendCharToCurrentCharacterToken = function (type, ch) { | |
if (this.currentCharacterToken && this.currentCharacterToken.type !== type) | |
this._emitCurrentCharacterToken(); | |
if (this.currentCharacterToken) | |
this.currentCharacterToken.chars += ch; | |
else { | |
this.currentCharacterToken = { | |
type: type, | |
chars: ch | |
}; | |
} | |
}; | |
Tokenizer.prototype._emitCodePoint = function (cp) { | |
var type = Tokenizer.CHARACTER_TOKEN; | |
if (isWhitespace(cp)) | |
type = Tokenizer.WHITESPACE_CHARACTER_TOKEN; | |
else if (cp === $.NULL) | |
type = Tokenizer.NULL_CHARACTER_TOKEN; | |
this._appendCharToCurrentCharacterToken(type, toChar(cp)); | |
}; | |
Tokenizer.prototype._emitSeveralCodePoints = function (codePoints) { | |
for (var i = 0; i < codePoints.length; i++) | |
this._emitCodePoint(codePoints[i]); | |
}; | |
//NOTE: used then we emit character explicitly. This is always a non-whitespace and a non-null character. | |
//So we can avoid additional checks here. | |
Tokenizer.prototype._emitChar = function (ch) { | |
this._appendCharToCurrentCharacterToken(Tokenizer.CHARACTER_TOKEN, ch); | |
}; | |
//Character reference tokenization | |
Tokenizer.prototype._consumeNumericEntity = function (isHex) { | |
var digits = '', | |
nextCp = $.UNDEFINED; | |
do { | |
digits += toChar(this._consume()); | |
nextCp = this._lookahead(); | |
} while (nextCp !== $.EOF && isDigit(nextCp, isHex)); | |
if (this._lookahead() === $.SEMICOLON) | |
this._consume(); | |
var referencedCp = parseInt(digits, isHex ? 16 : 10), | |
replacement = NUMERIC_ENTITY_REPLACEMENTS[referencedCp]; | |
if (replacement) | |
return replacement; | |
if (isReservedCodePoint(referencedCp)) | |
return $.REPLACEMENT_CHARACTER; | |
return referencedCp; | |
}; | |
Tokenizer.prototype._consumeNamedEntity = function (startCp, inAttr) { | |
var referencedCodePoints = null, | |
entityCodePointsCount = 0, | |
cp = startCp, | |
leaf = NAMED_ENTITY_TRIE[cp], | |
consumedCount = 1, | |
semicolonTerminated = false; | |
for (; leaf && cp !== $.EOF; cp = this._consume(), consumedCount++, leaf = leaf.l && leaf.l[cp]) { | |
if (leaf.c) { | |
//NOTE: we have at least one named reference match. But we don't stop lookup at this point, | |
//because longer matches still can be found (e.g. '¬' and '∉') except the case | |
//then found match is terminated by semicolon. | |
referencedCodePoints = leaf.c; | |
entityCodePointsCount = consumedCount; | |
if (cp === $.SEMICOLON) { | |
semicolonTerminated = true; | |
break; | |
} | |
} | |
} | |
if (referencedCodePoints) { | |
if (!semicolonTerminated) { | |
//NOTE: unconsume excess (e.g. 'it' in '¬it') | |
this._unconsumeSeveral(consumedCount - entityCodePointsCount); | |
//NOTE: If the character reference is being consumed as part of an attribute and the next character | |
//is either a U+003D EQUALS SIGN character (=) or an alphanumeric ASCII character, then, for historical | |
//reasons, all the characters that were matched after the U+0026 AMPERSAND character (&) must be | |
//unconsumed, and nothing is returned. | |
//However, if this next character is in fact a U+003D EQUALS SIGN character (=), then this is a | |
//parse error, because some legacy user agents will misinterpret the markup in those cases. | |
//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#tokenizing-character-references) | |
if (inAttr) { | |
var nextCp = this._lookahead(); | |
if (nextCp === $.EQUALS_SIGN || isAsciiAlphaNumeric(nextCp)) { | |
this._unconsumeSeveral(entityCodePointsCount); | |
return null; | |
} | |
} | |
} | |
return referencedCodePoints; | |
} | |
this._unconsumeSeveral(consumedCount); | |
return null; | |
}; | |
Tokenizer.prototype._consumeCharacterReference = function (startCp, inAttr) { | |
if (isWhitespace(startCp) || startCp === $.GREATER_THAN_SIGN || startCp === $.AMPERSAND || | |
startCp === this.additionalAllowedCp || startCp === $.EOF) { | |
//NOTE: not a character reference. No characters are consumed, and nothing is returned. | |
this._unconsume(); | |
return null; | |
} | |
else if (startCp === $.NUMBER_SIGN) { | |
//NOTE: we have a numeric entity candidate, now we should determine if it's hex or decimal | |
var isHex = false, | |
nextCp = this._lookahead(); | |
if (nextCp === $.LATIN_SMALL_X || nextCp === $.LATIN_CAPITAL_X) { | |
this._consume(); | |
isHex = true; | |
} | |
nextCp = this._lookahead(); | |
//NOTE: if we have at least one digit this is a numeric entity for sure, so we consume it | |
if (nextCp !== $.EOF && isDigit(nextCp, isHex)) | |
return [this._consumeNumericEntity(isHex)]; | |
else { | |
//NOTE: otherwise this is a bogus number entity and a parse error. Unconsume the number sign | |
//and the 'x'-character if appropriate. | |
this._unconsumeSeveral(isHex ? 2 : 1); | |
return null; | |
} | |
} | |
else | |
return this._consumeNamedEntity(startCp, inAttr); | |
}; | |
//State machine | |
var _ = Tokenizer.prototype; | |
//12.2.4.1 Data state | |
//------------------------------------------------------------------ | |
_[DATA_STATE] = function dataState(cp) { | |
if (cp === $.AMPERSAND) | |
this.state = CHARACTER_REFERENCE_IN_DATA_STATE; | |
else if (cp === $.LESS_THAN_SIGN) | |
this.state = TAG_OPEN_STATE; | |
else if (cp === $.NULL) | |
this._emitCodePoint(cp); | |
else if (cp === $.EOF) | |
this._emitEOFToken(); | |
else | |
this._emitCodePoint(cp); | |
}; | |
//12.2.4.2 Character reference in data state | |
//------------------------------------------------------------------ | |
_[CHARACTER_REFERENCE_IN_DATA_STATE] = function characterReferenceInDataState(cp) { | |
this.state = DATA_STATE; | |
this.additionalAllowedCp = $.UNDEFINED; | |
var referencedCodePoints = this._consumeCharacterReference(cp, false); | |
if (referencedCodePoints) | |
this._emitSeveralCodePoints(referencedCodePoints); | |
else | |
this._emitChar('&'); | |
}; | |
//12.2.4.3 RCDATA state | |
//------------------------------------------------------------------ | |
_[RCDATA_STATE] = function rcdataState(cp) { | |
if (cp === $.AMPERSAND) | |
this.state = CHARACTER_REFERENCE_IN_RCDATA_STATE; | |
else if (cp === $.LESS_THAN_SIGN) | |
this.state = RCDATA_LESS_THAN_SIGN_STATE; | |
else if (cp === $.NULL) | |
this._emitChar(UNICODE.REPLACEMENT_CHARACTER); | |
else if (cp === $.EOF) | |
this._emitEOFToken(); | |
else | |
this._emitCodePoint(cp); | |
}; | |
//12.2.4.4 Character reference in RCDATA state | |
//------------------------------------------------------------------ | |
_[CHARACTER_REFERENCE_IN_RCDATA_STATE] = function characterReferenceInRcdataState(cp) { | |
this.state = RCDATA_STATE; | |
this.additionalAllowedCp = $.UNDEFINED; | |
var referencedCodePoints = this._consumeCharacterReference(cp, false); | |
if (referencedCodePoints) | |
this._emitSeveralCodePoints(referencedCodePoints); | |
else | |
this._emitChar('&'); | |
}; | |
//12.2.4.5 RAWTEXT state | |
//------------------------------------------------------------------ | |
_[RAWTEXT_STATE] = function rawtextState(cp) { | |
if (cp === $.LESS_THAN_SIGN) | |
this.state = RAWTEXT_LESS_THAN_SIGN_STATE; | |
else if (cp === $.NULL) | |
this._emitChar(UNICODE.REPLACEMENT_CHARACTER); | |
else if (cp === $.EOF) | |
this._emitEOFToken(); | |
else | |
this._emitCodePoint(cp); | |
}; | |
//12.2.4.6 Script data state | |
//------------------------------------------------------------------ | |
_[SCRIPT_DATA_STATE] = function scriptDataState(cp) { | |
if (cp === $.LESS_THAN_SIGN) | |
this.state = SCRIPT_DATA_LESS_THAN_SIGN_STATE; | |
else if (cp === $.NULL) | |
this._emitChar(UNICODE.REPLACEMENT_CHARACTER); | |
else if (cp === $.EOF) | |
this._emitEOFToken(); | |
else | |
this._emitCodePoint(cp); | |
}; | |
//12.2.4.7 PLAINTEXT state | |
//------------------------------------------------------------------ | |
_[PLAINTEXT_STATE] = function plaintextState(cp) { | |
if (cp === $.NULL) | |
this._emitChar(UNICODE.REPLACEMENT_CHARACTER); | |
else if (cp === $.EOF) | |
this._emitEOFToken(); | |
else | |
this._emitCodePoint(cp); | |
}; | |
//12.2.4.8 Tag open state | |
//------------------------------------------------------------------ | |
_[TAG_OPEN_STATE] = function tagOpenState(cp) { | |
if (cp === $.EXCLAMATION_MARK) | |
this.state = MARKUP_DECLARATION_OPEN_STATE; | |
else if (cp === $.SOLIDUS) | |
this.state = END_TAG_OPEN_STATE; | |
else if (isAsciiUpper(cp)) { | |
this._createStartTagToken(toAsciiLowerChar(cp)); | |
this.state = TAG_NAME_STATE; | |
} | |
else if (isAsciiLower(cp)) { | |
this._createStartTagToken(toChar(cp)); | |
this.state = TAG_NAME_STATE; | |
} | |
else if (cp === $.QUESTION_MARK) { | |
//NOTE: call bogus comment state directly with current consumed character to avoid unnecessary reconsumption. | |
this[BOGUS_COMMENT_STATE](cp); | |
} | |
else { | |
this._emitChar('<'); | |
this._reconsumeInState(DATA_STATE); | |
} | |
}; | |
//12.2.4.9 End tag open state | |
//------------------------------------------------------------------ | |
_[END_TAG_OPEN_STATE] = function endTagOpenState(cp) { | |
if (isAsciiUpper(cp)) { | |
this._createEndTagToken(toAsciiLowerChar(cp)); | |
this.state = TAG_NAME_STATE; | |
} | |
else if (isAsciiLower(cp)) { | |
this._createEndTagToken(toChar(cp)); | |
this.state = TAG_NAME_STATE; | |
} | |
else if (cp === $.GREATER_THAN_SIGN) | |
this.state = DATA_STATE; | |
else if (cp === $.EOF) { | |
this._reconsumeInState(DATA_STATE); | |
this._emitChar('<'); | |
this._emitChar('/'); | |
} | |
else { | |
//NOTE: call bogus comment state directly with current consumed character to avoid unnecessary reconsumption. | |
this[BOGUS_COMMENT_STATE](cp); | |
} | |
}; | |
//12.2.4.10 Tag name state | |
//------------------------------------------------------------------ | |
_[TAG_NAME_STATE] = function tagNameState(cp) { | |
if (isWhitespace(cp)) | |
this.state = BEFORE_ATTRIBUTE_NAME_STATE; | |
else if (cp === $.SOLIDUS) | |
this.state = SELF_CLOSING_START_TAG_STATE; | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.state = DATA_STATE; | |
this._emitCurrentToken(); | |
} | |
else if (isAsciiUpper(cp)) | |
this.currentToken.tagName += toAsciiLowerChar(cp); | |
else if (cp === $.NULL) | |
this.currentToken.tagName += UNICODE.REPLACEMENT_CHARACTER; | |
else if (cp === $.EOF) | |
this._reconsumeInState(DATA_STATE); | |
else | |
this.currentToken.tagName += toChar(cp); | |
}; | |
//12.2.4.11 RCDATA less-than sign state | |
//------------------------------------------------------------------ | |
_[RCDATA_LESS_THAN_SIGN_STATE] = function rcdataLessThanSignState(cp) { | |
if (cp === $.SOLIDUS) { | |
this.tempBuff = []; | |
this.state = RCDATA_END_TAG_OPEN_STATE; | |
} | |
else { | |
this._emitChar('<'); | |
this._reconsumeInState(RCDATA_STATE); | |
} | |
}; | |
//12.2.4.12 RCDATA end tag open state | |
//------------------------------------------------------------------ | |
_[RCDATA_END_TAG_OPEN_STATE] = function rcdataEndTagOpenState(cp) { | |
if (isAsciiUpper(cp)) { | |
this._createEndTagToken(toAsciiLowerChar(cp)); | |
this.tempBuff.push(cp); | |
this.state = RCDATA_END_TAG_NAME_STATE; | |
} | |
else if (isAsciiLower(cp)) { | |
this._createEndTagToken(toChar(cp)); | |
this.tempBuff.push(cp); | |
this.state = RCDATA_END_TAG_NAME_STATE; | |
} | |
else { | |
this._emitChar('<'); | |
this._emitChar('/'); | |
this._reconsumeInState(RCDATA_STATE); | |
} | |
}; | |
//12.2.4.13 RCDATA end tag name state | |
//------------------------------------------------------------------ | |
_[RCDATA_END_TAG_NAME_STATE] = function rcdataEndTagNameState(cp) { | |
if (isAsciiUpper(cp)) { | |
this.currentToken.tagName += toAsciiLowerChar(cp); | |
this.tempBuff.push(cp); | |
} | |
else if (isAsciiLower(cp)) { | |
this.currentToken.tagName += toChar(cp); | |
this.tempBuff.push(cp); | |
} | |
else { | |
if (this._isAppropriateEndTagToken()) { | |
if (isWhitespace(cp)) { | |
this.state = BEFORE_ATTRIBUTE_NAME_STATE; | |
return; | |
} | |
if (cp === $.SOLIDUS) { | |
this.state = SELF_CLOSING_START_TAG_STATE; | |
return; | |
} | |
if (cp === $.GREATER_THAN_SIGN) { | |
this.state = DATA_STATE; | |
this._emitCurrentToken(); | |
return; | |
} | |
} | |
this._emitChar('<'); | |
this._emitChar('/'); | |
this._emitSeveralCodePoints(this.tempBuff); | |
this._reconsumeInState(RCDATA_STATE); | |
} | |
}; | |
//12.2.4.14 RAWTEXT less-than sign state | |
//------------------------------------------------------------------ | |
_[RAWTEXT_LESS_THAN_SIGN_STATE] = function rawtextLessThanSignState(cp) { | |
if (cp === $.SOLIDUS) { | |
this.tempBuff = []; | |
this.state = RAWTEXT_END_TAG_OPEN_STATE; | |
} | |
else { | |
this._emitChar('<'); | |
this._reconsumeInState(RAWTEXT_STATE); | |
} | |
}; | |
//12.2.4.15 RAWTEXT end tag open state | |
//------------------------------------------------------------------ | |
_[RAWTEXT_END_TAG_OPEN_STATE] = function rawtextEndTagOpenState(cp) { | |
if (isAsciiUpper(cp)) { | |
this._createEndTagToken(toAsciiLowerChar(cp)); | |
this.tempBuff.push(cp); | |
this.state = RAWTEXT_END_TAG_NAME_STATE; | |
} | |
else if (isAsciiLower(cp)) { | |
this._createEndTagToken(toChar(cp)); | |
this.tempBuff.push(cp); | |
this.state = RAWTEXT_END_TAG_NAME_STATE; | |
} | |
else { | |
this._emitChar('<'); | |
this._emitChar('/'); | |
this._reconsumeInState(RAWTEXT_STATE); | |
} | |
}; | |
//12.2.4.16 RAWTEXT end tag name state | |
//------------------------------------------------------------------ | |
_[RAWTEXT_END_TAG_NAME_STATE] = function rawtextEndTagNameState(cp) { | |
if (isAsciiUpper(cp)) { | |
this.currentToken.tagName += toAsciiLowerChar(cp); | |
this.tempBuff.push(cp); | |
} | |
else if (isAsciiLower(cp)) { | |
this.currentToken.tagName += toChar(cp); | |
this.tempBuff.push(cp); | |
} | |
else { | |
if (this._isAppropriateEndTagToken()) { | |
if (isWhitespace(cp)) { | |
this.state = BEFORE_ATTRIBUTE_NAME_STATE; | |
return; | |
} | |
if (cp === $.SOLIDUS) { | |
this.state = SELF_CLOSING_START_TAG_STATE; | |
return; | |
} | |
if (cp === $.GREATER_THAN_SIGN) { | |
this._emitCurrentToken(); | |
this.state = DATA_STATE; | |
return; | |
} | |
} | |
this._emitChar('<'); | |
this._emitChar('/'); | |
this._emitSeveralCodePoints(this.tempBuff); | |
this._reconsumeInState(RAWTEXT_STATE); | |
} | |
}; | |
//12.2.4.17 Script data less-than sign state | |
//------------------------------------------------------------------ | |
_[SCRIPT_DATA_LESS_THAN_SIGN_STATE] = function scriptDataLessThanSignState(cp) { | |
if (cp === $.SOLIDUS) { | |
this.tempBuff = []; | |
this.state = SCRIPT_DATA_END_TAG_OPEN_STATE; | |
} | |
else if (cp === $.EXCLAMATION_MARK) { | |
this.state = SCRIPT_DATA_ESCAPE_START_STATE; | |
this._emitChar('<'); | |
this._emitChar('!'); | |
} | |
else { | |
this._emitChar('<'); | |
this._reconsumeInState(SCRIPT_DATA_STATE); | |
} | |
}; | |
//12.2.4.18 Script data end tag open state | |
//------------------------------------------------------------------ | |
_[SCRIPT_DATA_END_TAG_OPEN_STATE] = function scriptDataEndTagOpenState(cp) { | |
if (isAsciiUpper(cp)) { | |
this._createEndTagToken(toAsciiLowerChar(cp)); | |
this.tempBuff.push(cp); | |
this.state = SCRIPT_DATA_END_TAG_NAME_STATE; | |
} | |
else if (isAsciiLower(cp)) { | |
this._createEndTagToken(toChar(cp)); | |
this.tempBuff.push(cp); | |
this.state = SCRIPT_DATA_END_TAG_NAME_STATE; | |
} | |
else { | |
this._emitChar('<'); | |
this._emitChar('/'); | |
this._reconsumeInState(SCRIPT_DATA_STATE); | |
} | |
}; | |
//12.2.4.19 Script data end tag name state | |
//------------------------------------------------------------------ | |
_[SCRIPT_DATA_END_TAG_NAME_STATE] = function scriptDataEndTagNameState(cp) { | |
if (isAsciiUpper(cp)) { | |
this.currentToken.tagName += toAsciiLowerChar(cp); | |
this.tempBuff.push(cp); | |
} | |
else if (isAsciiLower(cp)) { | |
this.currentToken.tagName += toChar(cp); | |
this.tempBuff.push(cp); | |
} | |
else { | |
if (this._isAppropriateEndTagToken()) { | |
if (isWhitespace(cp)) { | |
this.state = BEFORE_ATTRIBUTE_NAME_STATE; | |
return; | |
} | |
else if (cp === $.SOLIDUS) { | |
this.state = SELF_CLOSING_START_TAG_STATE; | |
return; | |
} | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this._emitCurrentToken(); | |
this.state = DATA_STATE; | |
return; | |
} | |
} | |
this._emitChar('<'); | |
this._emitChar('/'); | |
this._emitSeveralCodePoints(this.tempBuff); | |
this._reconsumeInState(SCRIPT_DATA_STATE); | |
} | |
}; | |
//12.2.4.20 Script data escape start state | |
//------------------------------------------------------------------ | |
_[SCRIPT_DATA_ESCAPE_START_STATE] = function scriptDataEscapeStartState(cp) { | |
if (cp === $.HYPHEN_MINUS) { | |
this.state = SCRIPT_DATA_ESCAPE_START_DASH_STATE; | |
this._emitChar('-'); | |
} | |
else | |
this._reconsumeInState(SCRIPT_DATA_STATE); | |
}; | |
//12.2.4.21 Script data escape start dash state | |
//------------------------------------------------------------------ | |
_[SCRIPT_DATA_ESCAPE_START_DASH_STATE] = function scriptDataEscapeStartDashState(cp) { | |
if (cp === $.HYPHEN_MINUS) { | |
this.state = SCRIPT_DATA_ESCAPED_DASH_DASH_STATE; | |
this._emitChar('-'); | |
} | |
else | |
this._reconsumeInState(SCRIPT_DATA_STATE); | |
}; | |
//12.2.4.22 Script data escaped state | |
//------------------------------------------------------------------ | |
_[SCRIPT_DATA_ESCAPED_STATE] = function scriptDataEscapedState(cp) { | |
if (cp === $.HYPHEN_MINUS) { | |
this.state = SCRIPT_DATA_ESCAPED_DASH_STATE; | |
this._emitChar('-'); | |
} | |
else if (cp === $.LESS_THAN_SIGN) | |
this.state = SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE; | |
else if (cp === $.NULL) | |
this._emitChar(UNICODE.REPLACEMENT_CHARACTER); | |
else if (cp === $.EOF) | |
this._reconsumeInState(DATA_STATE); | |
else | |
this._emitCodePoint(cp); | |
}; | |
//12.2.4.23 Script data escaped dash state | |
//------------------------------------------------------------------ | |
_[SCRIPT_DATA_ESCAPED_DASH_STATE] = function scriptDataEscapedDashState(cp) { | |
if (cp === $.HYPHEN_MINUS) { | |
this.state = SCRIPT_DATA_ESCAPED_DASH_DASH_STATE; | |
this._emitChar('-'); | |
} | |
else if (cp === $.LESS_THAN_SIGN) | |
this.state = SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE; | |
else if (cp === $.NULL) { | |
this.state = SCRIPT_DATA_ESCAPED_STATE; | |
this._emitChar(UNICODE.REPLACEMENT_CHARACTER); | |
} | |
else if (cp === $.EOF) | |
this._reconsumeInState(DATA_STATE); | |
else { | |
this.state = SCRIPT_DATA_ESCAPED_STATE; | |
this._emitCodePoint(cp); | |
} | |
}; | |
//12.2.4.24 Script data escaped dash dash state | |
//------------------------------------------------------------------ | |
_[SCRIPT_DATA_ESCAPED_DASH_DASH_STATE] = function scriptDataEscapedDashDashState(cp) { | |
if (cp === $.HYPHEN_MINUS) | |
this._emitChar('-'); | |
else if (cp === $.LESS_THAN_SIGN) | |
this.state = SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE; | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.state = SCRIPT_DATA_STATE; | |
this._emitChar('>'); | |
} | |
else if (cp === $.NULL) { | |
this.state = SCRIPT_DATA_ESCAPED_STATE; | |
this._emitChar(UNICODE.REPLACEMENT_CHARACTER); | |
} | |
else if (cp === $.EOF) | |
this._reconsumeInState(DATA_STATE); | |
else { | |
this.state = SCRIPT_DATA_ESCAPED_STATE; | |
this._emitCodePoint(cp); | |
} | |
}; | |
//12.2.4.25 Script data escaped less-than sign state | |
//------------------------------------------------------------------ | |
_[SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE] = function scriptDataEscapedLessThanSignState(cp) { | |
if (cp === $.SOLIDUS) { | |
this.tempBuff = []; | |
this.state = SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE; | |
} | |
else if (isAsciiUpper(cp)) { | |
this.tempBuff = []; | |
this.tempBuff.push(toAsciiLowerCodePoint(cp)); | |
this.state = SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE; | |
this._emitChar('<'); | |
this._emitCodePoint(cp); | |
} | |
else if (isAsciiLower(cp)) { | |
this.tempBuff = []; | |
this.tempBuff.push(cp); | |
this.state = SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE; | |
this._emitChar('<'); | |
this._emitCodePoint(cp); | |
} | |
else { | |
this._emitChar('<'); | |
this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE); | |
} | |
}; | |
//12.2.4.26 Script data escaped end tag open state | |
//------------------------------------------------------------------ | |
_[SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE] = function scriptDataEscapedEndTagOpenState(cp) { | |
if (isAsciiUpper(cp)) { | |
this._createEndTagToken(toAsciiLowerChar(cp)); | |
this.tempBuff.push(cp); | |
this.state = SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE; | |
} | |
else if (isAsciiLower(cp)) { | |
this._createEndTagToken(toChar(cp)); | |
this.tempBuff.push(cp); | |
this.state = SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE; | |
} | |
else { | |
this._emitChar('<'); | |
this._emitChar('/'); | |
this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE); | |
} | |
}; | |
//12.2.4.27 Script data escaped end tag name state | |
//------------------------------------------------------------------ | |
_[SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE] = function scriptDataEscapedEndTagNameState(cp) { | |
if (isAsciiUpper(cp)) { | |
this.currentToken.tagName += toAsciiLowerChar(cp); | |
this.tempBuff.push(cp); | |
} | |
else if (isAsciiLower(cp)) { | |
this.currentToken.tagName += toChar(cp); | |
this.tempBuff.push(cp); | |
} | |
else { | |
if (this._isAppropriateEndTagToken()) { | |
if (isWhitespace(cp)) { | |
this.state = BEFORE_ATTRIBUTE_NAME_STATE; | |
return; | |
} | |
if (cp === $.SOLIDUS) { | |
this.state = SELF_CLOSING_START_TAG_STATE; | |
return; | |
} | |
if (cp === $.GREATER_THAN_SIGN) { | |
this._emitCurrentToken(); | |
this.state = DATA_STATE; | |
return; | |
} | |
} | |
this._emitChar('<'); | |
this._emitChar('/'); | |
this._emitSeveralCodePoints(this.tempBuff); | |
this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE); | |
} | |
}; | |
//12.2.4.28 Script data double escape start state | |
//------------------------------------------------------------------ | |
_[SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE] = function scriptDataDoubleEscapeStartState(cp) { | |
if (isWhitespace(cp) || cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN) { | |
this.state = this.isTempBufferEqualToScriptString() ? SCRIPT_DATA_DOUBLE_ESCAPED_STATE : SCRIPT_DATA_ESCAPED_STATE; | |
this._emitCodePoint(cp); | |
} | |
else if (isAsciiUpper(cp)) { | |
this.tempBuff.push(toAsciiLowerCodePoint(cp)); | |
this._emitCodePoint(cp); | |
} | |
else if (isAsciiLower(cp)) { | |
this.tempBuff.push(cp); | |
this._emitCodePoint(cp); | |
} | |
else | |
this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE); | |
}; | |
//12.2.4.29 Script data double escaped state | |
//------------------------------------------------------------------ | |
_[SCRIPT_DATA_DOUBLE_ESCAPED_STATE] = function scriptDataDoubleEscapedState(cp) { | |
if (cp === $.HYPHEN_MINUS) { | |
this.state = SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE; | |
this._emitChar('-'); | |
} | |
else if (cp === $.LESS_THAN_SIGN) { | |
this.state = SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE; | |
this._emitChar('<'); | |
} | |
else if (cp === $.NULL) | |
this._emitChar(UNICODE.REPLACEMENT_CHARACTER); | |
else if (cp === $.EOF) | |
this._reconsumeInState(DATA_STATE); | |
else | |
this._emitCodePoint(cp); | |
}; | |
//12.2.4.30 Script data double escaped dash state | |
//------------------------------------------------------------------ | |
_[SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE] = function scriptDataDoubleEscapedDashState(cp) { | |
if (cp === $.HYPHEN_MINUS) { | |
this.state = SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE; | |
this._emitChar('-'); | |
} | |
else if (cp === $.LESS_THAN_SIGN) { | |
this.state = SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE; | |
this._emitChar('<'); | |
} | |
else if (cp === $.NULL) { | |
this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE; | |
this._emitChar(UNICODE.REPLACEMENT_CHARACTER); | |
} | |
else if (cp === $.EOF) | |
this._reconsumeInState(DATA_STATE); | |
else { | |
this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE; | |
this._emitCodePoint(cp); | |
} | |
}; | |
//12.2.4.31 Script data double escaped dash dash state | |
//------------------------------------------------------------------ | |
_[SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE] = function scriptDataDoubleEscapedDashDashState(cp) { | |
if (cp === $.HYPHEN_MINUS) | |
this._emitChar('-'); | |
else if (cp === $.LESS_THAN_SIGN) { | |
this.state = SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE; | |
this._emitChar('<'); | |
} | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.state = SCRIPT_DATA_STATE; | |
this._emitChar('>'); | |
} | |
else if (cp === $.NULL) { | |
this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE; | |
this._emitChar(UNICODE.REPLACEMENT_CHARACTER); | |
} | |
else if (cp === $.EOF) | |
this._reconsumeInState(DATA_STATE); | |
else { | |
this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE; | |
this._emitCodePoint(cp); | |
} | |
}; | |
//12.2.4.32 Script data double escaped less-than sign state | |
//------------------------------------------------------------------ | |
_[SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE] = function scriptDataDoubleEscapedLessThanSignState(cp) { | |
if (cp === $.SOLIDUS) { | |
this.tempBuff = []; | |
this.state = SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE; | |
this._emitChar('/'); | |
} | |
else | |
this._reconsumeInState(SCRIPT_DATA_DOUBLE_ESCAPED_STATE); | |
}; | |
//12.2.4.33 Script data double escape end state | |
//------------------------------------------------------------------ | |
_[SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE] = function scriptDataDoubleEscapeEndState(cp) { | |
if (isWhitespace(cp) || cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN) { | |
this.state = this.isTempBufferEqualToScriptString() ? SCRIPT_DATA_ESCAPED_STATE : SCRIPT_DATA_DOUBLE_ESCAPED_STATE; | |
this._emitCodePoint(cp); | |
} | |
else if (isAsciiUpper(cp)) { | |
this.tempBuff.push(toAsciiLowerCodePoint(cp)); | |
this._emitCodePoint(cp); | |
} | |
else if (isAsciiLower(cp)) { | |
this.tempBuff.push(cp); | |
this._emitCodePoint(cp); | |
} | |
else | |
this._reconsumeInState(SCRIPT_DATA_DOUBLE_ESCAPED_STATE); | |
}; | |
//12.2.4.34 Before attribute name state | |
//------------------------------------------------------------------ | |
_[BEFORE_ATTRIBUTE_NAME_STATE] = function beforeAttributeNameState(cp) { | |
if (isWhitespace(cp)) | |
return; | |
if (cp === $.SOLIDUS) | |
this.state = SELF_CLOSING_START_TAG_STATE; | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.state = DATA_STATE; | |
this._emitCurrentToken(); | |
} | |
else if (isAsciiUpper(cp)) { | |
this._createAttr(toAsciiLowerChar(cp)); | |
this.state = ATTRIBUTE_NAME_STATE; | |
} | |
else if (cp === $.NULL) { | |
this._createAttr(UNICODE.REPLACEMENT_CHARACTER); | |
this.state = ATTRIBUTE_NAME_STATE; | |
} | |
else if (cp === $.QUOTATION_MARK || cp === $.APOSTROPHE || cp === $.LESS_THAN_SIGN || cp === $.EQUALS_SIGN) { | |
this._createAttr(toChar(cp)); | |
this.state = ATTRIBUTE_NAME_STATE; | |
} | |
else if (cp === $.EOF) | |
this._reconsumeInState(DATA_STATE); | |
else { | |
this._createAttr(toChar(cp)); | |
this.state = ATTRIBUTE_NAME_STATE; | |
} | |
}; | |
//12.2.4.35 Attribute name state | |
//------------------------------------------------------------------ | |
_[ATTRIBUTE_NAME_STATE] = function attributeNameState(cp) { | |
if (isWhitespace(cp)) | |
this._leaveAttrName(AFTER_ATTRIBUTE_NAME_STATE); | |
else if (cp === $.SOLIDUS) | |
this._leaveAttrName(SELF_CLOSING_START_TAG_STATE); | |
else if (cp === $.EQUALS_SIGN) | |
this._leaveAttrName(BEFORE_ATTRIBUTE_VALUE_STATE); | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this._leaveAttrName(DATA_STATE); | |
this._emitCurrentToken(); | |
} | |
else if (isAsciiUpper(cp)) | |
this.currentAttr.name += toAsciiLowerChar(cp); | |
else if (cp === $.QUOTATION_MARK || cp === $.APOSTROPHE || cp === $.LESS_THAN_SIGN) | |
this.currentAttr.name += toChar(cp); | |
else if (cp === $.NULL) | |
this.currentAttr.name += UNICODE.REPLACEMENT_CHARACTER; | |
else if (cp === $.EOF) | |
this._reconsumeInState(DATA_STATE); | |
else | |
this.currentAttr.name += toChar(cp); | |
}; | |
//12.2.4.36 After attribute name state | |
//------------------------------------------------------------------ | |
_[AFTER_ATTRIBUTE_NAME_STATE] = function afterAttributeNameState(cp) { | |
if (isWhitespace(cp)) | |
return; | |
if (cp === $.SOLIDUS) | |
this.state = SELF_CLOSING_START_TAG_STATE; | |
else if (cp === $.EQUALS_SIGN) | |
this.state = BEFORE_ATTRIBUTE_VALUE_STATE; | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.state = DATA_STATE; | |
this._emitCurrentToken(); | |
} | |
else if (isAsciiUpper(cp)) { | |
this._createAttr(toAsciiLowerChar(cp)); | |
this.state = ATTRIBUTE_NAME_STATE; | |
} | |
else if (cp === $.NULL) { | |
this._createAttr(UNICODE.REPLACEMENT_CHARACTER); | |
this.state = ATTRIBUTE_NAME_STATE; | |
} | |
else if (cp === $.QUOTATION_MARK || cp === $.APOSTROPHE || cp === $.LESS_THAN_SIGN) { | |
this._createAttr(toChar(cp)); | |
this.state = ATTRIBUTE_NAME_STATE; | |
} | |
else if (cp === $.EOF) | |
this._reconsumeInState(DATA_STATE); | |
else { | |
this._createAttr(toChar(cp)); | |
this.state = ATTRIBUTE_NAME_STATE; | |
} | |
}; | |
//12.2.4.37 Before attribute value state | |
//------------------------------------------------------------------ | |
_[BEFORE_ATTRIBUTE_VALUE_STATE] = function beforeAttributeValueState(cp) { | |
if (isWhitespace(cp)) | |
return; | |
if (cp === $.QUOTATION_MARK) | |
this.state = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE; | |
else if (cp === $.AMPERSAND) | |
this._reconsumeInState(ATTRIBUTE_VALUE_UNQUOTED_STATE); | |
else if (cp === $.APOSTROPHE) | |
this.state = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE; | |
else if (cp === $.NULL) { | |
this.currentAttr.value += UNICODE.REPLACEMENT_CHARACTER; | |
this.state = ATTRIBUTE_VALUE_UNQUOTED_STATE; | |
} | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.state = DATA_STATE; | |
this._emitCurrentToken(); | |
} | |
else if (cp === $.LESS_THAN_SIGN || cp === $.EQUALS_SIGN || cp === $.GRAVE_ACCENT) { | |
this.currentAttr.value += toChar(cp); | |
this.state = ATTRIBUTE_VALUE_UNQUOTED_STATE; | |
} | |
else if (cp === $.EOF) | |
this._reconsumeInState(DATA_STATE); | |
else { | |
this.currentAttr.value += toChar(cp); | |
this.state = ATTRIBUTE_VALUE_UNQUOTED_STATE; | |
} | |
}; | |
//12.2.4.38 Attribute value (double-quoted) state | |
//------------------------------------------------------------------ | |
_[ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE] = function attributeValueDoubleQuotedState(cp) { | |
if (cp === $.QUOTATION_MARK) | |
this.state = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE; | |
else if (cp === $.AMPERSAND) { | |
this.additionalAllowedCp = $.QUOTATION_MARK; | |
this.returnState = this.state; | |
this.state = CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE_STATE; | |
} | |
else if (cp === $.NULL) | |
this.currentAttr.value += UNICODE.REPLACEMENT_CHARACTER; | |
else if (cp === $.EOF) | |
this._reconsumeInState(DATA_STATE); | |
else | |
this.currentAttr.value += toChar(cp); | |
}; | |
//12.2.4.39 Attribute value (single-quoted) state | |
//------------------------------------------------------------------ | |
_[ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE] = function attributeValueSingleQuotedState(cp) { | |
if (cp === $.APOSTROPHE) | |
this.state = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE; | |
else if (cp === $.AMPERSAND) { | |
this.additionalAllowedCp = $.APOSTROPHE; | |
this.returnState = this.state; | |
this.state = CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE_STATE; | |
} | |
else if (cp === $.NULL) | |
this.currentAttr.value += UNICODE.REPLACEMENT_CHARACTER; | |
else if (cp === $.EOF) | |
this._reconsumeInState(DATA_STATE); | |
else | |
this.currentAttr.value += toChar(cp); | |
}; | |
//12.2.4.40 Attribute value (unquoted) state | |
//------------------------------------------------------------------ | |
_[ATTRIBUTE_VALUE_UNQUOTED_STATE] = function attributeValueUnquotedState(cp) { | |
if (isWhitespace(cp)) | |
this.state = BEFORE_ATTRIBUTE_NAME_STATE; | |
else if (cp === $.AMPERSAND) { | |
this.additionalAllowedCp = $.GREATER_THAN_SIGN; | |
this.returnState = this.state; | |
this.state = CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE_STATE; | |
} | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.state = DATA_STATE; | |
this._emitCurrentToken(); | |
} | |
else if (cp === $.NULL) | |
this.currentAttr.value += UNICODE.REPLACEMENT_CHARACTER; | |
else if (cp === $.QUOTATION_MARK || cp === $.APOSTROPHE || cp === $.LESS_THAN_SIGN || | |
cp === $.EQUALS_SIGN || cp === $.GRAVE_ACCENT) { | |
this.currentAttr.value += toChar(cp); | |
} | |
else if (cp === $.EOF) | |
this._reconsumeInState(DATA_STATE); | |
else | |
this.currentAttr.value += toChar(cp); | |
}; | |
//12.2.4.41 Character reference in attribute value state | |
//------------------------------------------------------------------ | |
_[CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE_STATE] = function characterReferenceInAttributeValueState(cp) { | |
var referencedCodePoints = this._consumeCharacterReference(cp, true); | |
if (referencedCodePoints) { | |
for (var i = 0; i < referencedCodePoints.length; i++) | |
this.currentAttr.value += toChar(referencedCodePoints[i]); | |
} else | |
this.currentAttr.value += '&'; | |
this.state = this.returnState; | |
}; | |
//12.2.4.42 After attribute value (quoted) state | |
//------------------------------------------------------------------ | |
_[AFTER_ATTRIBUTE_VALUE_QUOTED_STATE] = function afterAttributeValueQuotedState(cp) { | |
if (isWhitespace(cp)) | |
this.state = BEFORE_ATTRIBUTE_NAME_STATE; | |
else if (cp === $.SOLIDUS) | |
this.state = SELF_CLOSING_START_TAG_STATE; | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.state = DATA_STATE; | |
this._emitCurrentToken(); | |
} | |
else if (cp === $.EOF) | |
this._reconsumeInState(DATA_STATE); | |
else | |
this._reconsumeInState(BEFORE_ATTRIBUTE_NAME_STATE); | |
}; | |
//12.2.4.43 Self-closing start tag state | |
//------------------------------------------------------------------ | |
_[SELF_CLOSING_START_TAG_STATE] = function selfClosingStartTagState(cp) { | |
if (cp === $.GREATER_THAN_SIGN) { | |
this.currentToken.selfClosing = true; | |
this.state = DATA_STATE; | |
this._emitCurrentToken(); | |
} | |
else if (cp === $.EOF) | |
this._reconsumeInState(DATA_STATE); | |
else | |
this._reconsumeInState(BEFORE_ATTRIBUTE_NAME_STATE); | |
}; | |
//12.2.4.44 Bogus comment state | |
//------------------------------------------------------------------ | |
_[BOGUS_COMMENT_STATE] = function bogusCommentState(cp) { | |
this._createCommentToken(); | |
while (true) { | |
if (cp === $.GREATER_THAN_SIGN) { | |
this.state = DATA_STATE; | |
break; | |
} | |
else if (cp === $.EOF) { | |
this._reconsumeInState(DATA_STATE); | |
break; | |
} | |
else { | |
this.currentToken.data += cp === $.NULL ? UNICODE.REPLACEMENT_CHARACTER : toChar(cp); | |
cp = this._consume(); | |
} | |
} | |
this._emitCurrentToken(); | |
}; | |
//12.2.4.45 Markup declaration open state | |
//------------------------------------------------------------------ | |
_[MARKUP_DECLARATION_OPEN_STATE] = function markupDeclarationOpenState(cp) { | |
if (this._consumeSubsequentIfMatch($$.DASH_DASH_STRING, cp, true)) { | |
this._createCommentToken(); | |
this.state = COMMENT_START_STATE; | |
} | |
else if (this._consumeSubsequentIfMatch($$.DOCTYPE_STRING, cp, false)) | |
this.state = DOCTYPE_STATE; | |
else if (this.allowCDATA && this._consumeSubsequentIfMatch($$.CDATA_START_STRING, cp, true)) | |
this.state = CDATA_SECTION_STATE; | |
else { | |
//NOTE: call bogus comment state directly with current consumed character to avoid unnecessary reconsumption. | |
this[BOGUS_COMMENT_STATE](cp); | |
} | |
}; | |
//12.2.4.46 Comment start state | |
//------------------------------------------------------------------ | |
_[COMMENT_START_STATE] = function commentStartState(cp) { | |
if (cp === $.HYPHEN_MINUS) | |
this.state = COMMENT_START_DASH_STATE; | |
else if (cp === $.NULL) { | |
this.currentToken.data += UNICODE.REPLACEMENT_CHARACTER; | |
this.state = COMMENT_STATE; | |
} | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.state = DATA_STATE; | |
this._emitCurrentToken(); | |
} | |
else if (cp === $.EOF) { | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else { | |
this.currentToken.data += toChar(cp); | |
this.state = COMMENT_STATE; | |
} | |
}; | |
//12.2.4.47 Comment start dash state | |
//------------------------------------------------------------------ | |
_[COMMENT_START_DASH_STATE] = function commentStartDashState(cp) { | |
if (cp === $.HYPHEN_MINUS) | |
this.state = COMMENT_END_STATE; | |
else if (cp === $.NULL) { | |
this.currentToken.data += '-'; | |
this.currentToken.data += UNICODE.REPLACEMENT_CHARACTER; | |
this.state = COMMENT_STATE; | |
} | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.state = DATA_STATE; | |
this._emitCurrentToken(); | |
} | |
else if (cp === $.EOF) { | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else { | |
this.currentToken.data += '-'; | |
this.currentToken.data += toChar(cp); | |
this.state = COMMENT_STATE; | |
} | |
}; | |
//12.2.4.48 Comment state | |
//------------------------------------------------------------------ | |
_[COMMENT_STATE] = function commentState(cp) { | |
if (cp === $.HYPHEN_MINUS) | |
this.state = COMMENT_END_DASH_STATE; | |
else if (cp === $.NULL) | |
this.currentToken.data += UNICODE.REPLACEMENT_CHARACTER; | |
else if (cp === $.EOF) { | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else | |
this.currentToken.data += toChar(cp); | |
}; | |
//12.2.4.49 Comment end dash state | |
//------------------------------------------------------------------ | |
_[COMMENT_END_DASH_STATE] = function commentEndDashState(cp) { | |
if (cp === $.HYPHEN_MINUS) | |
this.state = COMMENT_END_STATE; | |
else if (cp === $.NULL) { | |
this.currentToken.data += '-'; | |
this.currentToken.data += UNICODE.REPLACEMENT_CHARACTER; | |
this.state = COMMENT_STATE; | |
} | |
else if (cp === $.EOF) { | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else { | |
this.currentToken.data += '-'; | |
this.currentToken.data += toChar(cp); | |
this.state = COMMENT_STATE; | |
} | |
}; | |
//12.2.4.50 Comment end state | |
//------------------------------------------------------------------ | |
_[COMMENT_END_STATE] = function commentEndState(cp) { | |
if (cp === $.GREATER_THAN_SIGN) { | |
this.state = DATA_STATE; | |
this._emitCurrentToken(); | |
} | |
else if (cp === $.EXCLAMATION_MARK) | |
this.state = COMMENT_END_BANG_STATE; | |
else if (cp === $.HYPHEN_MINUS) | |
this.currentToken.data += '-'; | |
else if (cp === $.NULL) { | |
this.currentToken.data += '--'; | |
this.currentToken.data += UNICODE.REPLACEMENT_CHARACTER; | |
this.state = COMMENT_STATE; | |
} | |
else if (cp === $.EOF) { | |
this._reconsumeInState(DATA_STATE); | |
this._emitCurrentToken(); | |
} | |
else { | |
this.currentToken.data += '--'; | |
this.currentToken.data += toChar(cp); | |
this.state = COMMENT_STATE; | |
} | |
}; | |
//12.2.4.51 Comment end bang state | |
//------------------------------------------------------------------ | |
_[COMMENT_END_BANG_STATE] = function commentEndBangState(cp) { | |
if (cp === $.HYPHEN_MINUS) { | |
this.currentToken.data += '--!'; | |
this.state = COMMENT_END_DASH_STATE; | |
} | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.state = DATA_STATE; | |
this._emitCurrentToken(); | |
} | |
else if (cp === $.NULL) { | |
this.currentToken.data += '--!'; | |
this.currentToken.data += UNICODE.REPLACEMENT_CHARACTER; | |
this.state = COMMENT_STATE; | |
} | |
else if (cp === $.EOF) { | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else { | |
this.currentToken.data += '--!'; | |
this.currentToken.data += toChar(cp); | |
this.state = COMMENT_STATE; | |
} | |
}; | |
//12.2.4.52 DOCTYPE state | |
//------------------------------------------------------------------ | |
_[DOCTYPE_STATE] = function doctypeState(cp) { | |
if (isWhitespace(cp)) | |
this.state = BEFORE_DOCTYPE_NAME_STATE; | |
else if (cp === $.EOF) { | |
this._createDoctypeToken(); | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else | |
this._reconsumeInState(BEFORE_DOCTYPE_NAME_STATE); | |
}; | |
//12.2.4.53 Before DOCTYPE name state | |
//------------------------------------------------------------------ | |
_[BEFORE_DOCTYPE_NAME_STATE] = function beforeDoctypeNameState(cp) { | |
if (isWhitespace(cp)) | |
return; | |
if (isAsciiUpper(cp)) { | |
this._createDoctypeToken(toAsciiLowerChar(cp)); | |
this.state = DOCTYPE_NAME_STATE; | |
} | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this._createDoctypeToken(); | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this.state = DATA_STATE; | |
} | |
else if (cp === $.EOF) { | |
this._createDoctypeToken(); | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else if (cp === $.NULL) { | |
this._createDoctypeToken(UNICODE.REPLACEMENT_CHARACTER); | |
this.state = DOCTYPE_NAME_STATE; | |
} | |
else { | |
this._createDoctypeToken(toChar(cp)); | |
this.state = DOCTYPE_NAME_STATE; | |
} | |
}; | |
//12.2.4.54 DOCTYPE name state | |
//------------------------------------------------------------------ | |
_[DOCTYPE_NAME_STATE] = function doctypeNameState(cp) { | |
if (isWhitespace(cp)) | |
this.state = AFTER_DOCTYPE_NAME_STATE; | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this._emitCurrentToken(); | |
this.state = DATA_STATE; | |
} | |
else if (isAsciiUpper(cp)) | |
this.currentToken.name += toAsciiLowerChar(cp); | |
else if (cp === $.NULL) | |
this.currentToken.name += UNICODE.REPLACEMENT_CHARACTER; | |
else if (cp === $.EOF) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else | |
this.currentToken.name += toChar(cp); | |
}; | |
//12.2.4.55 After DOCTYPE name state | |
//------------------------------------------------------------------ | |
_[AFTER_DOCTYPE_NAME_STATE] = function afterDoctypeNameState(cp) { | |
if (isWhitespace(cp)) | |
return; | |
if (cp === $.GREATER_THAN_SIGN) { | |
this.state = DATA_STATE; | |
this._emitCurrentToken(); | |
} | |
else if (cp === $.EOF) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else if (this._consumeSubsequentIfMatch($$.PUBLIC_STRING, cp, false)) | |
this.state = AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE; | |
else if (this._consumeSubsequentIfMatch($$.SYSTEM_STRING, cp, false)) | |
this.state = AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE; | |
else { | |
this.currentToken.forceQuirks = true; | |
this.state = BOGUS_DOCTYPE_STATE; | |
} | |
}; | |
//12.2.4.56 After DOCTYPE public keyword state | |
//------------------------------------------------------------------ | |
_[AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE] = function afterDoctypePublicKeywordState(cp) { | |
if (isWhitespace(cp)) | |
this.state = BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE; | |
else if (cp === $.QUOTATION_MARK) { | |
this.currentToken.publicId = ''; | |
this.state = DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE; | |
} | |
else if (cp === $.APOSTROPHE) { | |
this.currentToken.publicId = ''; | |
this.state = DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE; | |
} | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this.state = DATA_STATE; | |
} | |
else if (cp === $.EOF) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else { | |
this.currentToken.forceQuirks = true; | |
this.state = BOGUS_DOCTYPE_STATE; | |
} | |
}; | |
//12.2.4.57 Before DOCTYPE public identifier state | |
//------------------------------------------------------------------ | |
_[BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE] = function beforeDoctypePublicIdentifierState(cp) { | |
if (isWhitespace(cp)) | |
return; | |
if (cp === $.QUOTATION_MARK) { | |
this.currentToken.publicId = ''; | |
this.state = DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE; | |
} | |
else if (cp === $.APOSTROPHE) { | |
this.currentToken.publicId = ''; | |
this.state = DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE; | |
} | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this.state = DATA_STATE; | |
} | |
else if (cp === $.EOF) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else { | |
this.currentToken.forceQuirks = true; | |
this.state = BOGUS_DOCTYPE_STATE; | |
} | |
}; | |
//12.2.4.58 DOCTYPE public identifier (double-quoted) state | |
//------------------------------------------------------------------ | |
_[DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE] = function doctypePublicIdentifierDoubleQuotedState(cp) { | |
if (cp === $.QUOTATION_MARK) | |
this.state = AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE; | |
else if (cp === $.NULL) | |
this.currentToken.publicId += UNICODE.REPLACEMENT_CHARACTER; | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this.state = DATA_STATE; | |
} | |
else if (cp === $.EOF) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else | |
this.currentToken.publicId += toChar(cp); | |
}; | |
//12.2.4.59 DOCTYPE public identifier (single-quoted) state | |
//------------------------------------------------------------------ | |
_[DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE] = function doctypePublicIdentifierSingleQuotedState(cp) { | |
if (cp === $.APOSTROPHE) | |
this.state = AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE; | |
else if (cp === $.NULL) | |
this.currentToken.publicId += UNICODE.REPLACEMENT_CHARACTER; | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this.state = DATA_STATE; | |
} | |
else if (cp === $.EOF) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else | |
this.currentToken.publicId += toChar(cp); | |
}; | |
//12.2.4.60 After DOCTYPE public identifier state | |
//------------------------------------------------------------------ | |
_[AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE] = function afterDoctypePublicIdentifierState(cp) { | |
if (isWhitespace(cp)) | |
this.state = BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE; | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this._emitCurrentToken(); | |
this.state = DATA_STATE; | |
} | |
else if (cp === $.QUOTATION_MARK) { | |
this.currentToken.systemId = ''; | |
this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE; | |
} | |
else if (cp === $.APOSTROPHE) { | |
this.currentToken.systemId = ''; | |
this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE; | |
} | |
else if (cp === $.EOF) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else { | |
this.currentToken.forceQuirks = true; | |
this.state = BOGUS_DOCTYPE_STATE; | |
} | |
}; | |
//12.2.4.61 Between DOCTYPE public and system identifiers state | |
//------------------------------------------------------------------ | |
_[BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE] = function betweenDoctypePublicAndSystemIdentifiersState(cp) { | |
if (isWhitespace(cp)) | |
return; | |
if (cp === $.GREATER_THAN_SIGN) { | |
this._emitCurrentToken(); | |
this.state = DATA_STATE; | |
} | |
else if (cp === $.QUOTATION_MARK) { | |
this.currentToken.systemId = ''; | |
this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE; | |
} | |
else if (cp === $.APOSTROPHE) { | |
this.currentToken.systemId = ''; | |
this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE; | |
} | |
else if (cp === $.EOF) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else { | |
this.currentToken.forceQuirks = true; | |
this.state = BOGUS_DOCTYPE_STATE; | |
} | |
}; | |
//12.2.4.62 After DOCTYPE system keyword state | |
//------------------------------------------------------------------ | |
_[AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE] = function afterDoctypeSystemKeywordState(cp) { | |
if (isWhitespace(cp)) | |
this.state = BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE; | |
else if (cp === $.QUOTATION_MARK) { | |
this.currentToken.systemId = ''; | |
this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE; | |
} | |
else if (cp === $.APOSTROPHE) { | |
this.currentToken.systemId = ''; | |
this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE; | |
} | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this.state = DATA_STATE; | |
} | |
else if (cp === $.EOF) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else { | |
this.currentToken.forceQuirks = true; | |
this.state = BOGUS_DOCTYPE_STATE; | |
} | |
}; | |
//12.2.4.63 Before DOCTYPE system identifier state | |
//------------------------------------------------------------------ | |
_[BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE] = function beforeDoctypeSystemIdentifierState(cp) { | |
if (isWhitespace(cp)) | |
return; | |
if (cp === $.QUOTATION_MARK) { | |
this.currentToken.systemId = ''; | |
this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE; | |
} | |
else if (cp === $.APOSTROPHE) { | |
this.currentToken.systemId = ''; | |
this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE; | |
} | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this.state = DATA_STATE; | |
} | |
else if (cp === $.EOF) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else { | |
this.currentToken.forceQuirks = true; | |
this.state = BOGUS_DOCTYPE_STATE; | |
} | |
}; | |
//12.2.4.64 DOCTYPE system identifier (double-quoted) state | |
//------------------------------------------------------------------ | |
_[DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE] = function doctypeSystemIdentifierDoubleQuotedState(cp) { | |
if (cp === $.QUOTATION_MARK) | |
this.state = AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE; | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this.state = DATA_STATE; | |
} | |
else if (cp === $.NULL) | |
this.currentToken.systemId += UNICODE.REPLACEMENT_CHARACTER; | |
else if (cp === $.EOF) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else | |
this.currentToken.systemId += toChar(cp); | |
}; | |
//12.2.4.65 DOCTYPE system identifier (single-quoted) state | |
//------------------------------------------------------------------ | |
_[DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE] = function doctypeSystemIdentifierSingleQuotedState(cp) { | |
if (cp === $.APOSTROPHE) | |
this.state = AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE; | |
else if (cp === $.GREATER_THAN_SIGN) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this.state = DATA_STATE; | |
} | |
else if (cp === $.NULL) | |
this.currentToken.systemId += UNICODE.REPLACEMENT_CHARACTER; | |
else if (cp === $.EOF) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else | |
this.currentToken.systemId += toChar(cp); | |
}; | |
//12.2.4.66 After DOCTYPE system identifier state | |
//------------------------------------------------------------------ | |
_[AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE] = function afterDoctypeSystemIdentifierState(cp) { | |
if (isWhitespace(cp)) | |
return; | |
if (cp === $.GREATER_THAN_SIGN) { | |
this._emitCurrentToken(); | |
this.state = DATA_STATE; | |
} | |
else if (cp === $.EOF) { | |
this.currentToken.forceQuirks = true; | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
else | |
this.state = BOGUS_DOCTYPE_STATE; | |
}; | |
//12.2.4.67 Bogus DOCTYPE state | |
//------------------------------------------------------------------ | |
_[BOGUS_DOCTYPE_STATE] = function bogusDoctypeState(cp) { | |
if (cp === $.GREATER_THAN_SIGN) { | |
this._emitCurrentToken(); | |
this.state = DATA_STATE; | |
} | |
else if (cp === $.EOF) { | |
this._emitCurrentToken(); | |
this._reconsumeInState(DATA_STATE); | |
} | |
}; | |
//12.2.4.68 CDATA section state | |
//------------------------------------------------------------------ | |
_[CDATA_SECTION_STATE] = function cdataSectionState(cp) { | |
while (true) { | |
if (cp === $.EOF) { | |
this._reconsumeInState(DATA_STATE); | |
break; | |
} | |
else if (this._consumeSubsequentIfMatch($$.CDATA_END_STRING, cp, true)) { | |
this.state = DATA_STATE; | |
break; | |
} | |
else { | |
this._emitCodePoint(cp); | |
cp = this._consume(); | |
} | |
} | |
}; | |
/***/ }, | |
/* 84 */ | |
/*!********************************************************!*\ | |
!*** ./~/jsdom/~/parse5/lib/common/foreign_content.js ***! | |
\********************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var Tokenizer = __webpack_require__(/*! ../tokenization/tokenizer */ 83), | |
HTML = __webpack_require__(/*! ./html */ 86); | |
//Aliases | |
var $ = HTML.TAG_NAMES, | |
NS = HTML.NAMESPACES, | |
ATTRS = HTML.ATTRS; | |
//MIME types | |
var MIME_TYPES = { | |
TEXT_HTML: 'text/html', | |
APPLICATION_XML: 'application/xhtml+xml' | |
}; | |
//Attributes | |
var DEFINITION_URL_ATTR = 'definitionurl', | |
ADJUSTED_DEFINITION_URL_ATTR = 'definitionURL', | |
SVG_ATTRS_ADJUSTMENT_MAP = { | |
'attributename': 'attributeName', | |
'attributetype': 'attributeType', | |
'basefrequency': 'baseFrequency', | |
'baseprofile': 'baseProfile', | |
'calcmode': 'calcMode', | |
'clippathunits': 'clipPathUnits', | |
'contentscripttype': 'contentScriptType', | |
'contentstyletype': 'contentStyleType', | |
'diffuseconstant': 'diffuseConstant', | |
'edgemode': 'edgeMode', | |
'externalresourcesrequired': 'externalResourcesRequired', | |
'filterres': 'filterRes', | |
'filterunits': 'filterUnits', | |
'glyphref': 'glyphRef', | |
'gradienttransform': 'gradientTransform', | |
'gradientunits': 'gradientUnits', | |
'kernelmatrix': 'kernelMatrix', | |
'kernelunitlength': 'kernelUnitLength', | |
'keypoints': 'keyPoints', | |
'keysplines': 'keySplines', | |
'keytimes': 'keyTimes', | |
'lengthadjust': 'lengthAdjust', | |
'limitingconeangle': 'limitingConeAngle', | |
'markerheight': 'markerHeight', | |
'markerunits': 'markerUnits', | |
'markerwidth': 'markerWidth', | |
'maskcontentunits': 'maskContentUnits', | |
'maskunits': 'maskUnits', | |
'numoctaves': 'numOctaves', | |
'pathlength': 'pathLength', | |
'patterncontentunits': 'patternContentUnits', | |
'patterntransform': 'patternTransform', | |
'patternunits': 'patternUnits', | |
'pointsatx': 'pointsAtX', | |
'pointsaty': 'pointsAtY', | |
'pointsatz': 'pointsAtZ', | |
'preservealpha': 'preserveAlpha', | |
'preserveaspectratio': 'preserveAspectRatio', | |
'primitiveunits': 'primitiveUnits', | |
'refx': 'refX', | |
'refy': 'refY', | |
'repeatcount': 'repeatCount', | |
'repeatdur': 'repeatDur', | |
'requiredextensions': 'requiredExtensions', | |
'requiredfeatures': 'requiredFeatures', | |
'specularconstant': 'specularConstant', | |
'specularexponent': 'specularExponent', | |
'spreadmethod': 'spreadMethod', | |
'startoffset': 'startOffset', | |
'stddeviation': 'stdDeviation', | |
'stitchtiles': 'stitchTiles', | |
'surfacescale': 'surfaceScale', | |
'systemlanguage': 'systemLanguage', | |
'tablevalues': 'tableValues', | |
'targetx': 'targetX', | |
'targety': 'targetY', | |
'textlength': 'textLength', | |
'viewbox': 'viewBox', | |
'viewtarget': 'viewTarget', | |
'xchannelselector': 'xChannelSelector', | |
'ychannelselector': 'yChannelSelector', | |
'zoomandpan': 'zoomAndPan' | |
}, | |
XML_ATTRS_ADJUSTMENT_MAP = { | |
'xlink:actuate': {prefix: 'xlink', name: 'actuate', namespace: NS.XLINK}, | |
'xlink:arcrole': {prefix: 'xlink', name: 'arcrole', namespace: NS.XLINK}, | |
'xlink:href': {prefix: 'xlink', name: 'href', namespace: NS.XLINK}, | |
'xlink:role': {prefix: 'xlink', name: 'role', namespace: NS.XLINK}, | |
'xlink:show': {prefix: 'xlink', name: 'show', namespace: NS.XLINK}, | |
'xlink:title': {prefix: 'xlink', name: 'title', namespace: NS.XLINK}, | |
'xlink:type': {prefix: 'xlink', name: 'type', namespace: NS.XLINK}, | |
'xml:base': {prefix: 'xml', name: 'base', namespace: NS.XML}, | |
'xml:lang': {prefix: 'xml', name: 'lang', namespace: NS.XML}, | |
'xml:space': {prefix: 'xml', name: 'space', namespace: NS.XML}, | |
'xmlns': {prefix: '', name: 'xmlns', namespace: NS.XMLNS}, | |
'xmlns:xlink': {prefix: 'xmlns', name: 'xlink', namespace: NS.XMLNS} | |
}; | |
//SVG tag names adjustment map | |
var SVG_TAG_NAMES_ADJUSTMENT_MAP = { | |
'altglyph': 'altGlyph', | |
'altglyphdef': 'altGlyphDef', | |
'altglyphitem': 'altGlyphItem', | |
'animatecolor': 'animateColor', | |
'animatemotion': 'animateMotion', | |
'animatetransform': 'animateTransform', | |
'clippath': 'clipPath', | |
'feblend': 'feBlend', | |
'fecolormatrix': 'feColorMatrix', | |
'fecomponenttransfer': 'feComponentTransfer', | |
'fecomposite': 'feComposite', | |
'feconvolvematrix': 'feConvolveMatrix', | |
'fediffuselighting': 'feDiffuseLighting', | |
'fedisplacementmap': 'feDisplacementMap', | |
'fedistantlight': 'feDistantLight', | |
'feflood': 'feFlood', | |
'fefunca': 'feFuncA', | |
'fefuncb': 'feFuncB', | |
'fefuncg': 'feFuncG', | |
'fefuncr': 'feFuncR', | |
'fegaussianblur': 'feGaussianBlur', | |
'feimage': 'feImage', | |
'femerge': 'feMerge', | |
'femergenode': 'feMergeNode', | |
'femorphology': 'feMorphology', | |
'feoffset': 'feOffset', | |
'fepointlight': 'fePointLight', | |
'fespecularlighting': 'feSpecularLighting', | |
'fespotlight': 'feSpotLight', | |
'fetile': 'feTile', | |
'feturbulence': 'feTurbulence', | |
'foreignobject': 'foreignObject', | |
'glyphref': 'glyphRef', | |
'lineargradient': 'linearGradient', | |
'radialgradient': 'radialGradient', | |
'textpath': 'textPath' | |
}; | |
//Tags that causes exit from foreign content | |
var EXITS_FOREIGN_CONTENT = {}; | |
EXITS_FOREIGN_CONTENT[$.B] = true; | |
EXITS_FOREIGN_CONTENT[$.BIG] = true; | |
EXITS_FOREIGN_CONTENT[$.BLOCKQUOTE] = true; | |
EXITS_FOREIGN_CONTENT[$.BODY] = true; | |
EXITS_FOREIGN_CONTENT[$.BR] = true; | |
EXITS_FOREIGN_CONTENT[$.CENTER] = true; | |
EXITS_FOREIGN_CONTENT[$.CODE] = true; | |
EXITS_FOREIGN_CONTENT[$.DD] = true; | |
EXITS_FOREIGN_CONTENT[$.DIV] = true; | |
EXITS_FOREIGN_CONTENT[$.DL] = true; | |
EXITS_FOREIGN_CONTENT[$.DT] = true; | |
EXITS_FOREIGN_CONTENT[$.EM] = true; | |
EXITS_FOREIGN_CONTENT[$.EMBED] = true; | |
EXITS_FOREIGN_CONTENT[$.H1] = true; | |
EXITS_FOREIGN_CONTENT[$.H2] = true; | |
EXITS_FOREIGN_CONTENT[$.H3] = true; | |
EXITS_FOREIGN_CONTENT[$.H4] = true; | |
EXITS_FOREIGN_CONTENT[$.H5] = true; | |
EXITS_FOREIGN_CONTENT[$.H6] = true; | |
EXITS_FOREIGN_CONTENT[$.HEAD] = true; | |
EXITS_FOREIGN_CONTENT[$.HR] = true; | |
EXITS_FOREIGN_CONTENT[$.I] = true; | |
EXITS_FOREIGN_CONTENT[$.IMG] = true; | |
EXITS_FOREIGN_CONTENT[$.LI] = true; | |
EXITS_FOREIGN_CONTENT[$.LISTING] = true; | |
EXITS_FOREIGN_CONTENT[$.MENU] = true; | |
EXITS_FOREIGN_CONTENT[$.META] = true; | |
EXITS_FOREIGN_CONTENT[$.NOBR] = true; | |
EXITS_FOREIGN_CONTENT[$.OL] = true; | |
EXITS_FOREIGN_CONTENT[$.P] = true; | |
EXITS_FOREIGN_CONTENT[$.PRE] = true; | |
EXITS_FOREIGN_CONTENT[$.RUBY] = true; | |
EXITS_FOREIGN_CONTENT[$.S] = true; | |
EXITS_FOREIGN_CONTENT[$.SMALL] = true; | |
EXITS_FOREIGN_CONTENT[$.SPAN] = true; | |
EXITS_FOREIGN_CONTENT[$.STRONG] = true; | |
EXITS_FOREIGN_CONTENT[$.STRIKE] = true; | |
EXITS_FOREIGN_CONTENT[$.SUB] = true; | |
EXITS_FOREIGN_CONTENT[$.SUP] = true; | |
EXITS_FOREIGN_CONTENT[$.TABLE] = true; | |
EXITS_FOREIGN_CONTENT[$.TT] = true; | |
EXITS_FOREIGN_CONTENT[$.U] = true; | |
EXITS_FOREIGN_CONTENT[$.UL] = true; | |
EXITS_FOREIGN_CONTENT[$.VAR] = true; | |
//Check exit from foreign content | |
exports.causesExit = function (startTagToken) { | |
var tn = startTagToken.tagName; | |
if (tn === $.FONT && (Tokenizer.getTokenAttr(startTagToken, ATTRS.COLOR) !== null || | |
Tokenizer.getTokenAttr(startTagToken, ATTRS.SIZE) !== null || | |
Tokenizer.getTokenAttr(startTagToken, ATTRS.FACE) !== null)) { | |
return true; | |
} | |
return EXITS_FOREIGN_CONTENT[tn]; | |
}; | |
//Token adjustments | |
exports.adjustTokenMathMLAttrs = function (token) { | |
for (var i = 0; i < token.attrs.length; i++) { | |
if (token.attrs[i].name === DEFINITION_URL_ATTR) { | |
token.attrs[i].name = ADJUSTED_DEFINITION_URL_ATTR; | |
break; | |
} | |
} | |
}; | |
exports.adjustTokenSVGAttrs = function (token) { | |
for (var i = 0; i < token.attrs.length; i++) { | |
var adjustedAttrName = SVG_ATTRS_ADJUSTMENT_MAP[token.attrs[i].name]; | |
if (adjustedAttrName) | |
token.attrs[i].name = adjustedAttrName; | |
} | |
}; | |
exports.adjustTokenXMLAttrs = function (token) { | |
for (var i = 0; i < token.attrs.length; i++) { | |
var adjustedAttrEntry = XML_ATTRS_ADJUSTMENT_MAP[token.attrs[i].name]; | |
if (adjustedAttrEntry) { | |
token.attrs[i].prefix = adjustedAttrEntry.prefix; | |
token.attrs[i].name = adjustedAttrEntry.name; | |
token.attrs[i].namespace = adjustedAttrEntry.namespace; | |
} | |
} | |
}; | |
exports.adjustTokenSVGTagName = function (token) { | |
var adjustedTagName = SVG_TAG_NAMES_ADJUSTMENT_MAP[token.tagName]; | |
if (adjustedTagName) | |
token.tagName = adjustedTagName; | |
}; | |
//Integration points | |
exports.isMathMLTextIntegrationPoint = function (tn, ns) { | |
return ns === NS.MATHML && (tn === $.MI || tn === $.MO || tn === $.MN || tn === $.MS || tn === $.MTEXT); | |
}; | |
exports.isHtmlIntegrationPoint = function (tn, ns, attrs) { | |
if (ns === NS.MATHML && tn === $.ANNOTATION_XML) { | |
for (var i = 0; i < attrs.length; i++) { | |
if (attrs[i].name === ATTRS.ENCODING) { | |
var value = attrs[i].value.toLowerCase(); | |
return value === MIME_TYPES.TEXT_HTML || value === MIME_TYPES.APPLICATION_XML; | |
} | |
} | |
} | |
return ns === NS.SVG && (tn === $.FOREIGN_OBJECT || tn === $.DESC || tn === $.TITLE); | |
}; | |
/***/ }, | |
/* 85 */ | |
/*!************************************************!*\ | |
!*** ./~/jsdom/~/parse5/lib/common/unicode.js ***! | |
\************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
exports.REPLACEMENT_CHARACTER = '\uFFFD'; | |
exports.CODE_POINTS = { | |
UNDEFINED: -2, | |
EOF: -1, | |
NULL: 0x00, | |
TABULATION: 0x09, | |
CARRIAGE_RETURN: 0x0D, | |
LINE_FEED: 0x0A, | |
FORM_FEED: 0x0C, | |
SPACE: 0x20, | |
EXCLAMATION_MARK: 0x21, | |
QUOTATION_MARK: 0x22, | |
NUMBER_SIGN: 0x23, | |
AMPERSAND: 0x26, | |
APOSTROPHE: 0x27, | |
HYPHEN_MINUS: 0x2D, | |
SOLIDUS: 0x2F, | |
DIGIT_0: 0x30, | |
DIGIT_9: 0x39, | |
SEMICOLON: 0x3B, | |
LESS_THAN_SIGN: 0x3C, | |
EQUALS_SIGN: 0x3D, | |
GREATER_THAN_SIGN: 0x3E, | |
QUESTION_MARK: 0x3F, | |
LATIN_CAPITAL_A: 0x41, | |
LATIN_CAPITAL_F: 0x46, | |
LATIN_CAPITAL_X: 0x58, | |
LATIN_CAPITAL_Z: 0x5A, | |
GRAVE_ACCENT: 0x60, | |
LATIN_SMALL_A: 0x61, | |
LATIN_SMALL_F: 0x66, | |
LATIN_SMALL_X: 0x78, | |
LATIN_SMALL_Z: 0x7A, | |
BOM: 0xFEFF, | |
REPLACEMENT_CHARACTER: 0xFFFD | |
}; | |
exports.CODE_POINT_SEQUENCES = { | |
DASH_DASH_STRING: [0x2D, 0x2D], //-- | |
DOCTYPE_STRING: [0x44, 0x4F, 0x43, 0x54, 0x59, 0x50, 0x45], //DOCTYPE | |
CDATA_START_STRING: [0x5B, 0x43, 0x44, 0x41, 0x54, 0x41, 0x5B], //[CDATA[ | |
CDATA_END_STRING: [0x5D, 0x5D, 0x3E], //]]> | |
SCRIPT_STRING: [0x73, 0x63, 0x72, 0x69, 0x70, 0x74], //script | |
PUBLIC_STRING: [0x50, 0x55, 0x42, 0x4C, 0x49, 0x43], //PUBLIC | |
SYSTEM_STRING: [0x53, 0x59, 0x53, 0x54, 0x45, 0x4D] //SYSTEM | |
}; | |
/***/ }, | |
/* 86 */ | |
/*!*********************************************!*\ | |
!*** ./~/jsdom/~/parse5/lib/common/html.js ***! | |
\*********************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var NS = exports.NAMESPACES = { | |
HTML: 'http://www.w3.org/1999/xhtml', | |
MATHML: 'http://www.w3.org/1998/Math/MathML', | |
SVG: 'http://www.w3.org/2000/svg', | |
XLINK: 'http://www.w3.org/1999/xlink', | |
XML: 'http://www.w3.org/XML/1998/namespace', | |
XMLNS: 'http://www.w3.org/2000/xmlns/' | |
}; | |
exports.ATTRS = { | |
TYPE: 'type', | |
ACTION: 'action', | |
ENCODING: 'encoding', | |
PROMPT: 'prompt', | |
NAME: 'name', | |
COLOR: 'color', | |
FACE: 'face', | |
SIZE: 'size' | |
}; | |
var $ = exports.TAG_NAMES = { | |
A: 'a', | |
ADDRESS: 'address', | |
ANNOTATION_XML: 'annotation-xml', | |
APPLET: 'applet', | |
AREA: 'area', | |
ARTICLE: 'article', | |
ASIDE: 'aside', | |
B: 'b', | |
BASE: 'base', | |
BASEFONT: 'basefont', | |
BGSOUND: 'bgsound', | |
BIG: 'big', | |
BLOCKQUOTE: 'blockquote', | |
BODY: 'body', | |
BR: 'br', | |
BUTTON: 'button', | |
CAPTION: 'caption', | |
CENTER: 'center', | |
CODE: 'code', | |
COL: 'col', | |
COLGROUP: 'colgroup', | |
COMMAND: 'command', | |
DD: 'dd', | |
DESC: 'desc', | |
DETAILS: 'details', | |
DIALOG: 'dialog', | |
DIR: 'dir', | |
DIV: 'div', | |
DL: 'dl', | |
DT: 'dt', | |
EM: 'em', | |
EMBED: 'embed', | |
FIELDSET: 'fieldset', | |
FIGCAPTION: 'figcaption', | |
FIGURE: 'figure', | |
FONT: 'font', | |
FOOTER: 'footer', | |
FOREIGN_OBJECT: 'foreignObject', | |
FORM: 'form', | |
FRAME: 'frame', | |
FRAMESET: 'frameset', | |
H1: 'h1', | |
H2: 'h2', | |
H3: 'h3', | |
H4: 'h4', | |
H5: 'h5', | |
H6: 'h6', | |
HEAD: 'head', | |
HEADER: 'header', | |
HGROUP: 'hgroup', | |
HR: 'hr', | |
HTML: 'html', | |
I: 'i', | |
IMG: 'img', | |
IMAGE: 'image', | |
INPUT: 'input', | |
IFRAME: 'iframe', | |
ISINDEX: 'isindex', | |
KEYGEN: 'keygen', | |
LABEL: 'label', | |
LI: 'li', | |
LINK: 'link', | |
LISTING: 'listing', | |
MAIN: 'main', | |
MALIGNMARK: 'malignmark', | |
MARQUEE: 'marquee', | |
MATH: 'math', | |
MENU: 'menu', | |
MENUITEM: 'menuitem', | |
META: 'meta', | |
MGLYPH: 'mglyph', | |
MI: 'mi', | |
MO: 'mo', | |
MN: 'mn', | |
MS: 'ms', | |
MTEXT: 'mtext', | |
NAV: 'nav', | |
NOBR: 'nobr', | |
NOFRAMES: 'noframes', | |
NOEMBED: 'noembed', | |
NOSCRIPT: 'noscript', | |
OBJECT: 'object', | |
OL: 'ol', | |
OPTGROUP: 'optgroup', | |
OPTION: 'option', | |
P: 'p', | |
PARAM: 'param', | |
PLAINTEXT: 'plaintext', | |
PRE: 'pre', | |
RP: 'rp', | |
RT: 'rt', | |
RUBY: 'ruby', | |
S: 's', | |
SCRIPT: 'script', | |
SECTION: 'section', | |
SELECT: 'select', | |
SOURCE: 'source', | |
SMALL: 'small', | |
SPAN: 'span', | |
STRIKE: 'strike', | |
STRONG: 'strong', | |
STYLE: 'style', | |
SUB: 'sub', | |
SUMMARY: 'summary', | |
SUP: 'sup', | |
TABLE: 'table', | |
TBODY: 'tbody', | |
TEXTAREA: 'textarea', | |
TFOOT: 'tfoot', | |
TD: 'td', | |
TH: 'th', | |
THEAD: 'thead', | |
TITLE: 'title', | |
TR: 'tr', | |
TRACK: 'track', | |
TT: 'tt', | |
U: 'u', | |
UL: 'ul', | |
SVG: 'svg', | |
VAR: 'var', | |
WBR: 'wbr', | |
XMP: 'xmp' | |
}; | |
var SPECIAL_ELEMENTS = exports.SPECIAL_ELEMENTS = {}; | |
SPECIAL_ELEMENTS[NS.HTML] = {}; | |
SPECIAL_ELEMENTS[NS.HTML][$.ADDRESS] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.APPLET] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.AREA] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.ARTICLE] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.ASIDE] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.BASE] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.BASEFONT] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.BGSOUND] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.BLOCKQUOTE] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.BODY] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.BR] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.BUTTON] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.CAPTION] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.CENTER] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.COL] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.COLGROUP] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.DD] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.DETAILS] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.DIR] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.DIV] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.DL] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.DT] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.EMBED] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.FIELDSET] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.FIGCAPTION] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.FIGURE] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.FOOTER] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.FORM] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.FRAME] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.FRAMESET] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.H1] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.H2] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.H3] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.H4] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.H5] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.H6] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.HEAD] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.HEADER] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.HGROUP] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.HR] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.HTML] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.IFRAME] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.IMG] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.INPUT] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.ISINDEX] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.LI] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.LINK] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.LISTING] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.MAIN] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.MARQUEE] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.MENU] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.MENUITEM] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.META] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.NAV] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.NOEMBED] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.NOFRAMES] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.NOSCRIPT] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.OBJECT] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.OL] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.P] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.PARAM] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.PLAINTEXT] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.PRE] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.SCRIPT] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.SECTION] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.SELECT] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.SOURCE] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.STYLE] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.SUMMARY] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.TABLE] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.TBODY] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.TD] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.TEXTAREA] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.TFOOT] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.TH] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.THEAD] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.TITLE] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.TR] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.TRACK] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.UL] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.WBR] = true; | |
SPECIAL_ELEMENTS[NS.HTML][$.XMP] = true; | |
SPECIAL_ELEMENTS[NS.MATHML] = {}; | |
SPECIAL_ELEMENTS[NS.MATHML][$.MI] = true; | |
SPECIAL_ELEMENTS[NS.MATHML][$.MO] = true; | |
SPECIAL_ELEMENTS[NS.MATHML][$.MN] = true; | |
SPECIAL_ELEMENTS[NS.MATHML][$.MS] = true; | |
SPECIAL_ELEMENTS[NS.MATHML][$.MTEXT] = true; | |
SPECIAL_ELEMENTS[NS.MATHML][$.ANNOTATION_XML] = true; | |
SPECIAL_ELEMENTS[NS.SVG] = {}; | |
SPECIAL_ELEMENTS[NS.SVG][$.TITLE] = true; | |
SPECIAL_ELEMENTS[NS.SVG][$.FOREIGN_OBJECT] = true; | |
SPECIAL_ELEMENTS[NS.SVG][$.DESC] = true; | |
/***/ }, | |
/* 87 */ | |
/*!****************************************************!*\ | |
!*** (webpack)/~/node-libs-browser/~/util/util.js ***! | |
\****************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a | |
// copy of this software and associated documentation files (the | |
// "Software"), to deal in the Software without restriction, including | |
// without limitation the rights to use, copy, modify, merge, publish, | |
// distribute, sublicense, and/or sell copies of the Software, and to permit | |
// persons to whom the Software is furnished to do so, subject to the | |
// following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included | |
// in all copies or substantial portions of the Software. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | |
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | |
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | |
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | |
// USE OR OTHER DEALINGS IN THE SOFTWARE. | |
var formatRegExp = /%[sdj%]/g; | |
exports.format = function(f) { | |
if (!isString(f)) { | |
var objects = []; | |
for (var i = 0; i < arguments.length; i++) { | |
objects.push(inspect(arguments[i])); | |
} | |
return objects.join(' '); | |
} | |
var i = 1; | |
var args = arguments; | |
var len = args.length; | |
var str = String(f).replace(formatRegExp, function(x) { | |
if (x === '%%') return '%'; | |
if (i >= len) return x; | |
switch (x) { | |
case '%s': return String(args[i++]); | |
case '%d': return Number(args[i++]); | |
case '%j': | |
try { | |
return JSON.stringify(args[i++]); | |
} catch (_) { | |
return '[Circular]'; | |
} | |
default: | |
return x; | |
} | |
}); | |
for (var x = args[i]; i < len; x = args[++i]) { | |
if (isNull(x) || !isObject(x)) { | |
str += ' ' + x; | |
} else { | |
str += ' ' + inspect(x); | |
} | |
} | |
return str; | |
}; | |
// Mark that a method should not be used. | |
// Returns a modified function which warns once by default. | |
// If --no-deprecation is set, then it is a no-op. | |
exports.deprecate = function(fn, msg) { | |
// Allow for deprecating things in the process of starting up. | |
if (isUndefined(global.process)) { | |
return function() { | |
return exports.deprecate(fn, msg).apply(this, arguments); | |
}; | |
} | |
if (process.noDeprecation === true) { | |
return fn; | |
} | |
var warned = false; | |
function deprecated() { | |
if (!warned) { | |
if (process.throwDeprecation) { | |
throw new Error(msg); | |
} else if (process.traceDeprecation) { | |
console.trace(msg); | |
} else { | |
console.error(msg); | |
} | |
warned = true; | |
} | |
return fn.apply(this, arguments); | |
} | |
return deprecated; | |
}; | |
var debugs = {}; | |
var debugEnviron; | |
exports.debuglog = function(set) { | |
if (isUndefined(debugEnviron)) | |
debugEnviron = process.env.NODE_DEBUG || ''; | |
set = set.toUpperCase(); | |
if (!debugs[set]) { | |
if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { | |
var pid = process.pid; | |
debugs[set] = function() { | |
var msg = exports.format.apply(exports, arguments); | |
console.error('%s %d: %s', set, pid, msg); | |
}; | |
} else { | |
debugs[set] = function() {}; | |
} | |
} | |
return debugs[set]; | |
}; | |
/** | |
* Echos the value of a value. Trys to print the value out | |
* in the best way possible given the different types. | |
* | |
* @param {Object} obj The object to print out. | |
* @param {Object} opts Optional options object that alters the output. | |
*/ | |
/* legacy: obj, showHidden, depth, colors*/ | |
function inspect(obj, opts) { | |
// default options | |
var ctx = { | |
seen: [], | |
stylize: stylizeNoColor | |
}; | |
// legacy... | |
if (arguments.length >= 3) ctx.depth = arguments[2]; | |
if (arguments.length >= 4) ctx.colors = arguments[3]; | |
if (isBoolean(opts)) { | |
// legacy... | |
ctx.showHidden = opts; | |
} else if (opts) { | |
// got an "options" object | |
exports._extend(ctx, opts); | |
} | |
// set default options | |
if (isUndefined(ctx.showHidden)) ctx.showHidden = false; | |
if (isUndefined(ctx.depth)) ctx.depth = 2; | |
if (isUndefined(ctx.colors)) ctx.colors = false; | |
if (isUndefined(ctx.customInspect)) ctx.customInspect = true; | |
if (ctx.colors) ctx.stylize = stylizeWithColor; | |
return formatValue(ctx, obj, ctx.depth); | |
} | |
exports.inspect = inspect; | |
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics | |
inspect.colors = { | |
'bold' : [1, 22], | |
'italic' : [3, 23], | |
'underline' : [4, 24], | |
'inverse' : [7, 27], | |
'white' : [37, 39], | |
'grey' : [90, 39], | |
'black' : [30, 39], | |
'blue' : [34, 39], | |
'cyan' : [36, 39], | |
'green' : [32, 39], | |
'magenta' : [35, 39], | |
'red' : [31, 39], | |
'yellow' : [33, 39] | |
}; | |
// Don't use 'blue' not visible on cmd.exe | |
inspect.styles = { | |
'special': 'cyan', | |
'number': 'yellow', | |
'boolean': 'yellow', | |
'undefined': 'grey', | |
'null': 'bold', | |
'string': 'green', | |
'date': 'magenta', | |
// "name": intentionally not styling | |
'regexp': 'red' | |
}; | |
function stylizeWithColor(str, styleType) { | |
var style = inspect.styles[styleType]; | |
if (style) { | |
return '\u001b[' + inspect.colors[style][0] + 'm' + str + | |
'\u001b[' + inspect.colors[style][1] + 'm'; | |
} else { | |
return str; | |
} | |
} | |
function stylizeNoColor(str, styleType) { | |
return str; | |
} | |
function arrayToHash(array) { | |
var hash = {}; | |
array.forEach(function(val, idx) { | |
hash[val] = true; | |
}); | |
return hash; | |
} | |
function formatValue(ctx, value, recurseTimes) { | |
// Provide a hook for user-specified inspect functions. | |
// Check that value is an object with an inspect function on it | |
if (ctx.customInspect && | |
value && | |
isFunction(value.inspect) && | |
// Filter out the util module, it's inspect function is special | |
value.inspect !== exports.inspect && | |
// Also filter out any prototype objects using the circular check. | |
!(value.constructor && value.constructor.prototype === value)) { | |
var ret = value.inspect(recurseTimes, ctx); | |
if (!isString(ret)) { | |
ret = formatValue(ctx, ret, recurseTimes); | |
} | |
return ret; | |
} | |
// Primitive types cannot have properties | |
var primitive = formatPrimitive(ctx, value); | |
if (primitive) { | |
return primitive; | |
} | |
// Look up the keys of the object. | |
var keys = Object.keys(value); | |
var visibleKeys = arrayToHash(keys); | |
if (ctx.showHidden) { | |
keys = Object.getOwnPropertyNames(value); | |
} | |
// IE doesn't make error fields non-enumerable | |
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx | |
if (isError(value) | |
&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { | |
return formatError(value); | |
} | |
// Some type of object without properties can be shortcutted. | |
if (keys.length === 0) { | |
if (isFunction(value)) { | |
var name = value.name ? ': ' + value.name : ''; | |
return ctx.stylize('[Function' + name + ']', 'special'); | |
} | |
if (isRegExp(value)) { | |
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); | |
} | |
if (isDate(value)) { | |
return ctx.stylize(Date.prototype.toString.call(value), 'date'); | |
} | |
if (isError(value)) { | |
return formatError(value); | |
} | |
} | |
var base = '', array = false, braces = ['{', '}']; | |
// Make Array say that they are Array | |
if (isArray(value)) { | |
array = true; | |
braces = ['[', ']']; | |
} | |
// Make functions say that they are functions | |
if (isFunction(value)) { | |
var n = value.name ? ': ' + value.name : ''; | |
base = ' [Function' + n + ']'; | |
} | |
// Make RegExps say that they are RegExps | |
if (isRegExp(value)) { | |
base = ' ' + RegExp.prototype.toString.call(value); | |
} | |
// Make dates with properties first say the date | |
if (isDate(value)) { | |
base = ' ' + Date.prototype.toUTCString.call(value); | |
} | |
// Make error with message first say the error | |
if (isError(value)) { | |
base = ' ' + formatError(value); | |
} | |
if (keys.length === 0 && (!array || value.length == 0)) { | |
return braces[0] + base + braces[1]; | |
} | |
if (recurseTimes < 0) { | |
if (isRegExp(value)) { | |
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); | |
} else { | |
return ctx.stylize('[Object]', 'special'); | |
} | |
} | |
ctx.seen.push(value); | |
var output; | |
if (array) { | |
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); | |
} else { | |
output = keys.map(function(key) { | |
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); | |
}); | |
} | |
ctx.seen.pop(); | |
return reduceToSingleString(output, base, braces); | |
} | |
function formatPrimitive(ctx, value) { | |
if (isUndefined(value)) | |
return ctx.stylize('undefined', 'undefined'); | |
if (isString(value)) { | |
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') | |
.replace(/'/g, "\\'") | |
.replace(/\\"/g, '"') + '\''; | |
return ctx.stylize(simple, 'string'); | |
} | |
if (isNumber(value)) | |
return ctx.stylize('' + value, 'number'); | |
if (isBoolean(value)) | |
return ctx.stylize('' + value, 'boolean'); | |
// For some reason typeof null is "object", so special case here. | |
if (isNull(value)) | |
return ctx.stylize('null', 'null'); | |
} | |
function formatError(value) { | |
return '[' + Error.prototype.toString.call(value) + ']'; | |
} | |
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { | |
var output = []; | |
for (var i = 0, l = value.length; i < l; ++i) { | |
if (hasOwnProperty(value, String(i))) { | |
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, | |
String(i), true)); | |
} else { | |
output.push(''); | |
} | |
} | |
keys.forEach(function(key) { | |
if (!key.match(/^\d+$/)) { | |
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, | |
key, true)); | |
} | |
}); | |
return output; | |
} | |
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { | |
var name, str, desc; | |
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; | |
if (desc.get) { | |
if (desc.set) { | |
str = ctx.stylize('[Getter/Setter]', 'special'); | |
} else { | |
str = ctx.stylize('[Getter]', 'special'); | |
} | |
} else { | |
if (desc.set) { | |
str = ctx.stylize('[Setter]', 'special'); | |
} | |
} | |
if (!hasOwnProperty(visibleKeys, key)) { | |
name = '[' + key + ']'; | |
} | |
if (!str) { | |
if (ctx.seen.indexOf(desc.value) < 0) { | |
if (isNull(recurseTimes)) { | |
str = formatValue(ctx, desc.value, null); | |
} else { | |
str = formatValue(ctx, desc.value, recurseTimes - 1); | |
} | |
if (str.indexOf('\n') > -1) { | |
if (array) { | |
str = str.split('\n').map(function(line) { | |
return ' ' + line; | |
}).join('\n').substr(2); | |
} else { | |
str = '\n' + str.split('\n').map(function(line) { | |
return ' ' + line; | |
}).join('\n'); | |
} | |
} | |
} else { | |
str = ctx.stylize('[Circular]', 'special'); | |
} | |
} | |
if (isUndefined(name)) { | |
if (array && key.match(/^\d+$/)) { | |
return str; | |
} | |
name = JSON.stringify('' + key); | |
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { | |
name = name.substr(1, name.length - 2); | |
name = ctx.stylize(name, 'name'); | |
} else { | |
name = name.replace(/'/g, "\\'") | |
.replace(/\\"/g, '"') | |
.replace(/(^"|"$)/g, "'"); | |
name = ctx.stylize(name, 'string'); | |
} | |
} | |
return name + ': ' + str; | |
} | |
function reduceToSingleString(output, base, braces) { | |
var numLinesEst = 0; | |
var length = output.reduce(function(prev, cur) { | |
numLinesEst++; | |
if (cur.indexOf('\n') >= 0) numLinesEst++; | |
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; | |
}, 0); | |
if (length > 60) { | |
return braces[0] + | |
(base === '' ? '' : base + '\n ') + | |
' ' + | |
output.join(',\n ') + | |
' ' + | |
braces[1]; | |
} | |
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; | |
} | |
// NOTE: These type checking functions intentionally don't use `instanceof` | |
// because it is fragile and can be easily faked with `Object.create()`. | |
function isArray(ar) { | |
return Array.isArray(ar); | |
} | |
exports.isArray = isArray; | |
function isBoolean(arg) { | |
return typeof arg === 'boolean'; | |
} | |
exports.isBoolean = isBoolean; | |
function isNull(arg) { | |
return arg === null; | |
} | |
exports.isNull = isNull; | |
function isNullOrUndefined(arg) { | |
return arg == null; | |
} | |
exports.isNullOrUndefined = isNullOrUndefined; | |
function isNumber(arg) { | |
return typeof arg === 'number'; | |
} | |
exports.isNumber = isNumber; | |
function isString(arg) { | |
return typeof arg === 'string'; | |
} | |
exports.isString = isString; | |
function isSymbol(arg) { | |
return typeof arg === 'symbol'; | |
} | |
exports.isSymbol = isSymbol; | |
function isUndefined(arg) { | |
return arg === void 0; | |
} | |
exports.isUndefined = isUndefined; | |
function isRegExp(re) { | |
return isObject(re) && objectToString(re) === '[object RegExp]'; | |
} | |
exports.isRegExp = isRegExp; | |
function isObject(arg) { | |
return typeof arg === 'object' && arg !== null; | |
} | |
exports.isObject = isObject; | |
function isDate(d) { | |
return isObject(d) && objectToString(d) === '[object Date]'; | |
} | |
exports.isDate = isDate; | |
function isError(e) { | |
return isObject(e) && | |
(objectToString(e) === '[object Error]' || e instanceof Error); | |
} | |
exports.isError = isError; | |
function isFunction(arg) { | |
return typeof arg === 'function'; | |
} | |
exports.isFunction = isFunction; | |
function isPrimitive(arg) { | |
return arg === null || | |
typeof arg === 'boolean' || | |
typeof arg === 'number' || | |
typeof arg === 'string' || | |
typeof arg === 'symbol' || // ES6 symbol | |
typeof arg === 'undefined'; | |
} | |
exports.isPrimitive = isPrimitive; | |
exports.isBuffer = __webpack_require__(/*! ./support/isBuffer */ 107); | |
function objectToString(o) { | |
return Object.prototype.toString.call(o); | |
} | |
function pad(n) { | |
return n < 10 ? '0' + n.toString(10) : n.toString(10); | |
} | |
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', | |
'Oct', 'Nov', 'Dec']; | |
// 26 Feb 16:19:34 | |
function timestamp() { | |
var d = new Date(); | |
var time = [pad(d.getHours()), | |
pad(d.getMinutes()), | |
pad(d.getSeconds())].join(':'); | |
return [d.getDate(), months[d.getMonth()], time].join(' '); | |
} | |
// log is just a thin wrapper to console.log that prepends a timestamp | |
exports.log = function() { | |
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); | |
}; | |
/** | |
* Inherit the prototype methods from one constructor into another. | |
* | |
* The Function.prototype.inherits from lang.js rewritten as a standalone | |
* function (not on Function.prototype). NOTE: If this file is to be loaded | |
* during bootstrapping this function needs to be rewritten using some native | |
* functions as prototype setup using normal JavaScript does not work as | |
* expected during bootstrapping (see mirror.js in r114903). | |
* | |
* @param {function} ctor Constructor function which needs to inherit the | |
* prototype. | |
* @param {function} superCtor Constructor function to inherit prototype from. | |
*/ | |
exports.inherits = __webpack_require__(/*! inherits */ 108); | |
exports._extend = function(origin, add) { | |
// Don't do anything if add isn't an object | |
if (!add || !isObject(add)) return origin; | |
var keys = Object.keys(add); | |
var i = keys.length; | |
while (i--) { | |
origin[keys[i]] = add[keys[i]]; | |
} | |
return origin; | |
}; | |
function hasOwnProperty(obj, prop) { | |
return Object.prototype.hasOwnProperty.call(obj, prop); | |
} | |
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(/*! (webpack)/~/node-libs-browser/~/process/browser.js */ 13))) | |
/***/ }, | |
/* 88 */ | |
/*!*****************************************************!*\ | |
!*** ./~/jsdom/~/htmlparser2/~/domhandler/index.js ***! | |
\*****************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var ElementType = __webpack_require__(/*! domelementtype */ 90); | |
var re_whitespace = /\s+/g; | |
function DomHandler(callback, options, elementCB){ | |
if(typeof callback === "object"){ | |
elementCB = options; | |
options = callback; | |
callback = null; | |
} else if(typeof options === "function"){ | |
elementCB = options; | |
options = defaultOpts; | |
} | |
this._callback = callback; | |
this._options = options || defaultOpts; | |
this._elementCB = elementCB; | |
this.dom = []; | |
this._done = false; | |
this._tagStack = []; | |
} | |
//default options | |
var defaultOpts = { | |
normalizeWhitespace: false //Replace all whitespace with single spaces | |
}; | |
//Resets the handler back to starting state | |
DomHandler.prototype.onreset = function(){ | |
DomHandler.call(this, this._callback, this._options, this._elementCB); | |
}; | |
//Signals the handler that parsing is done | |
DomHandler.prototype.onend = function(){ | |
if(this._done) return; | |
this._done = true; | |
this._handleCallback(null); | |
}; | |
DomHandler.prototype._handleCallback = | |
DomHandler.prototype.onerror = function(error){ | |
if(typeof this._callback === "function"){ | |
this._callback(error, this.dom); | |
} else { | |
if(error) throw error; | |
} | |
}; | |
DomHandler.prototype.onclosetag = function(){ | |
//if(this._tagStack.pop().name !== name) this._handleCallback(Error("Tagname didn't match!")); | |
var elem = this._tagStack.pop(); | |
if(this._elementCB) this._elementCB(elem); | |
}; | |
DomHandler.prototype._addDomElement = function(element){ | |
var parent = this._tagStack[this._tagStack.length - 1]; | |
var siblings = parent ? parent.children : this.dom; | |
var previousSibling = siblings[siblings.length - 1]; | |
element.next = null; | |
if (this._options.withDomLvl1) { | |
element.__proto__ = NodePrototype; | |
} | |
if(previousSibling){ | |
element.prev = previousSibling; | |
previousSibling.next = element; | |
} else { | |
element.prev = null; | |
} | |
siblings.push(element); | |
element.parent = parent || null; | |
}; | |
// This object will be used as the prototype for Nodes when creating a | |
// DOM-Level-1-compliant structure. | |
var NodePrototype = { | |
get firstChild() { | |
var children = this.children; | |
return children && children[0] || null; | |
}, | |
get lastChild() { | |
var children = this.children; | |
return children && children[children.length - 1] || null; | |
}, | |
get nodeType() { | |
return nodeTypes[this.type] || nodeTypes.element; | |
} | |
}; | |
var domLvl1 = { | |
tagName: "name", | |
childNodes: "children", | |
parentNode: "parent", | |
previousSibling: "prev", | |
nextSibling: "next", | |
nodeValue: "data" | |
}; | |
var nodeTypes = { | |
element: 1, | |
text: 3, | |
cdata: 4, | |
comment: 8 | |
}; | |
Object.keys(domLvl1).forEach(function(key) { | |
var shorthand = domLvl1[key]; | |
Object.defineProperty(NodePrototype, key, { | |
get: function() { | |
return this[shorthand] || null; | |
}, | |
set: function(val) { | |
this[shorthand] = val; | |
return val; | |
} | |
}); | |
}); | |
DomHandler.prototype.onopentag = function(name, attribs){ | |
var element = { | |
type: name === "script" ? ElementType.Script : name === "style" ? ElementType.Style : ElementType.Tag, | |
name: name, | |
attribs: attribs, | |
children: [] | |
}; | |
this._addDomElement(element); | |
this._tagStack.push(element); | |
}; | |
DomHandler.prototype.ontext = function(data){ | |
//the ignoreWhitespace is officially dropped, but for now, | |
//it's an alias for normalizeWhitespace | |
var normalize = this._options.normalizeWhitespace || this._options.ignoreWhitespace; | |
var lastTag; | |
if(!this._tagStack.length && this.dom.length && (lastTag = this.dom[this.dom.length-1]).type === ElementType.Text){ | |
if(normalize){ | |
lastTag.data = (lastTag.data + data).replace(re_whitespace, " "); | |
} else { | |
lastTag.data += data; | |
} | |
} else { | |
if( | |
this._tagStack.length && | |
(lastTag = this._tagStack[this._tagStack.length - 1]) && | |
(lastTag = lastTag.children[lastTag.children.length - 1]) && | |
lastTag.type === ElementType.Text | |
){ | |
if(normalize){ | |
lastTag.data = (lastTag.data + data).replace(re_whitespace, " "); | |
} else { | |
lastTag.data += data; | |
} | |
} else { | |
if(normalize){ | |
data = data.replace(re_whitespace, " "); | |
} | |
this._addDomElement({ | |
data: data, | |
type: ElementType.Text | |
}); | |
} | |
} | |
}; | |
DomHandler.prototype.oncomment = function(data){ | |
var lastTag = this._tagStack[this._tagStack.length - 1]; | |
if(lastTag && lastTag.type === ElementType.Comment){ | |
lastTag.data += data; | |
return; | |
} | |
var element = { | |
data: data, | |
type: ElementType.Comment | |
}; | |
this._addDomElement(element); | |
this._tagStack.push(element); | |
}; | |
DomHandler.prototype.oncdatastart = function(){ | |
var element = { | |
children: [{ | |
data: "", | |
type: ElementType.Text | |
}], | |
type: ElementType.CDATA | |
}; | |
this._addDomElement(element); | |
this._tagStack.push(element); | |
}; | |
DomHandler.prototype.oncommentend = DomHandler.prototype.oncdataend = function(){ | |
this._tagStack.pop(); | |
}; | |
DomHandler.prototype.onprocessinginstruction = function(name, data){ | |
this._addDomElement({ | |
name: name, | |
data: data, | |
type: ElementType.Directive | |
}); | |
}; | |
module.exports = DomHandler; | |
/***/ }, | |
/* 89 */ | |
/*!***************************************************!*\ | |
!*** ./~/jsdom/~/htmlparser2/~/domutils/index.js ***! | |
\***************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var DomUtils = module.exports; | |
[ | |
__webpack_require__(/*! ./lib/stringify */ 99), | |
__webpack_require__(/*! ./lib/traversal */ 100), | |
__webpack_require__(/*! ./lib/manipulation */ 101), | |
__webpack_require__(/*! ./lib/querying */ 102), | |
__webpack_require__(/*! ./lib/legacy */ 103), | |
__webpack_require__(/*! ./lib/helpers */ 104) | |
].forEach(function(ext){ | |
Object.keys(ext).forEach(function(key){ | |
DomUtils[key] = ext[key].bind(DomUtils); | |
}); | |
}); | |
/***/ }, | |
/* 90 */ | |
/*!*********************************************************!*\ | |
!*** ./~/jsdom/~/htmlparser2/~/domelementtype/index.js ***! | |
\*********************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//Types of elements found in the DOM | |
module.exports = { | |
Text: "text", //Text | |
Directive: "directive", //<? ... ?> | |
Comment: "comment", //<!-- ... --> | |
Script: "script", //<script> tags | |
Style: "style", //<style> tags | |
Tag: "tag", //Any tag | |
CDATA: "cdata", //<![CDATA[ ... ]]> | |
isTag: function(elem){ | |
return elem.type === "tag" || elem.type === "script" || elem.type === "style"; | |
} | |
}; | |
/***/ }, | |
/* 91 */ | |
/*!********************************************************************************!*\ | |
!*** (webpack)/~/node-libs-browser/~/assert/~/util/support/isBufferBrowser.js ***! | |
\********************************************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
module.exports = function isBuffer(arg) { | |
return arg && typeof arg === 'object' | |
&& typeof arg.copy === 'function' | |
&& typeof arg.fill === 'function' | |
&& typeof arg.readUInt8 === 'function'; | |
} | |
/***/ }, | |
/* 92 */ | |
/*!***********************************************************!*\ | |
!*** ./~/jsdom/~/parse5/lib/tokenization/preprocessor.js ***! | |
\***********************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
var UNICODE = __webpack_require__(/*! ../common/unicode */ 85); | |
//Aliases | |
var $ = UNICODE.CODE_POINTS; | |
//Const | |
var CARRIAGE_RETURN_NEW_LINE_REGEX = /\r\n?/g; | |
//Utils | |
//OPTIMIZATION: these utility functions should not be moved out of this module. V8 Crankshaft will not inline | |
//this functions if they will be situated in another module due to context switch. | |
//Always perform inlining check before modifying this functions ('node --trace-inlining'). | |
function isReservedCodePoint(cp) { | |
return cp >= 0xD800 && cp <= 0xDFFF || cp > 0x10FFFF; | |
} | |
function isSurrogatePair(cp1, cp2) { | |
return cp1 >= 0xD800 && cp1 <= 0xDBFF && cp2 >= 0xDC00 && cp2 <= 0xDFFF; | |
} | |
function getSurrogatePairCodePoint(cp1, cp2) { | |
return (cp1 - 0xD800) * 0x400 + 0x2400 + cp2; | |
} | |
//Preprocessor | |
var Preprocessor = module.exports = function (html) { | |
//NOTE: All U+000D CARRIAGE RETURN (CR) characters must be converted to U+000A LINE FEED (LF) characters. | |
//Any U+000A LINE FEED (LF) characters that immediately follow a U+000D CARRIAGE RETURN (CR) character | |
//must be ignored. | |
this.html = html.replace(CARRIAGE_RETURN_NEW_LINE_REGEX, '\n'); | |
//NOTE: one leading U+FEFF BYTE ORDER MARK character must be ignored if any are present in the input stream. | |
this.pos = this.html.charCodeAt(0) === $.BOM ? 0 : -1; | |
this.lastCharPos = this.html.length - 1; | |
this.gapStack = []; | |
this.lastGapPos = -1; | |
}; | |
//NOTE: HTML input preprocessing | |
//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#preprocessing-the-input-stream) | |
Preprocessor.prototype.advanceAndPeekCodePoint = function () { | |
this.pos++; | |
if (this.pos > this.lastCharPos) | |
return $.EOF; | |
var cp = this.html.charCodeAt(this.pos); | |
//OPTIMIZATION: first perform check if the code point in the allowed range that covers most common | |
//HTML input (e.g. ASCII codes) to avoid performance-cost operations for high-range code points. | |
if (cp >= 0xD800) { | |
//NOTE: try to peek a surrogate pair | |
if (this.pos !== this.lastCharPos) { | |
var nextCp = this.html.charCodeAt(this.pos + 1); | |
if (isSurrogatePair(cp, nextCp)) { | |
//NOTE: we have a surrogate pair. Peek pair character and recalculate code point. | |
this.pos++; | |
cp = getSurrogatePairCodePoint(cp, nextCp); | |
//NOTE: add gap that should be avoided during retreat | |
this.gapStack.push(this.lastGapPos); | |
this.lastGapPos = this.pos; | |
} | |
} | |
if (isReservedCodePoint(cp)) | |
cp = $.REPLACEMENT_CHARACTER; | |
} | |
return cp; | |
}; | |
Preprocessor.prototype.retreat = function () { | |
if (this.pos === this.lastGapPos) { | |
this.lastGapPos = this.gapStack.pop(); | |
this.pos--; | |
} | |
this.pos--; | |
}; | |
/***/ }, | |
/* 93 */ | |
/*!****************************************************************!*\ | |
!*** ./~/jsdom/~/parse5/lib/tokenization/named_entity_trie.js ***! | |
\****************************************************************/ | |
/***/ function(module, exports, __webpack_require__) { | |
//NOTE: this file contains auto generated trie structure that is used for named entity references consumption | |
//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#tokenizing-character-references and | |
//http://www.whatwg.org/specs/web-apps/current-work/multipage/named-character-references.html#named-character-references) | |
module.exports = { | |
0x41: {l: {0x61: {l: {0x63: {l: {0x75: {l: {0x74: {l: {0x65: {l: {0x3B: {c: [193]}}, c: [193]}}}}}}}}}, 0x62: {l: {0x72: {l: {0x65: {l: {0x76: {l: {0x65: {l: {0x3B: {c: [258]}}}}}}}}}}}, 0x63: {l: {0x69: {l: {0x72: {l: {0x63: {l: {0x3B: {c: [194]}}, c: [194]}}}}}, 0x79: {l: {0x3B: {c: [1040]}}}}}, 0x45: {l: {0x6C: {l: {0x69: {l: {0x67: {l: {0x3B: {c: [198]}}, c: [198]}}}}}}}, 0x66: {l: {0x72: {l: {0x3B: {c: [120068]}}}}}, 0x67: {l: {0x72: {l: {0x61: {l: {0x76: {l: {0x65: {l: {0x3B: {c: [192]}}, c: [192]}}}}}}}}}, 0x6C: {l: {0x70: {l: {0x68: {l: {0x61: {l: {0x3B: {c: [913]}}}}}}}}}, 0x6D: {l: {0x61: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [256]}}}}}}}}}, 0x4D: {l: {0x50: {l: {0x3B: {c: [38]}}, c: [38]}}}, 0x6E: {l: {0x64: {l: {0x3B: {c: [10835]}}}}}, 0x6F: {l: {0x67: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [260]}}}}}}}, 0x70: {l: {0x66: {l: {0x3B: {c: [120120]}}}}}}}, 0x70: {l: {0x70: {l: {0x6C: {l: {0x79: {l: {0x46: {l: {0x75: {l: {0x6E: {l: {0x63: {l: {0x74: {l: {0x69: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [8289]}}}}}}}}}}}}}}}}}}}}}}}}}, 0x72: {l: {0x69: {l: {0x6E: {l: {0x67: {l: {0x3B: {c: [197]}}, c: [197]}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [119964]}}}}}, 0x73: {l: {0x69: {l: {0x67: {l: {0x6E: {l: {0x3B: {c: [8788]}}}}}}}}}}}, 0x74: {l: {0x69: {l: {0x6C: {l: {0x64: {l: {0x65: {l: {0x3B: {c: [195]}}, c: [195]}}}}}}}}}, 0x75: {l: {0x6D: {l: {0x6C: {l: {0x3B: {c: [196]}}, c: [196]}}}}}}}, | |
0x61: {l: {0x61: {l: {0x63: {l: {0x75: {l: {0x74: {l: {0x65: {l: {0x3B: {c: [225]}}, c: [225]}}}}}}}}}, 0x62: {l: {0x72: {l: {0x65: {l: {0x76: {l: {0x65: {l: {0x3B: {c: [259]}}}}}}}}}}}, 0x63: {l: {0x3B: {c: [8766]}, 0x64: {l: {0x3B: {c: [8767]}}}, 0x45: {l: {0x3B: {c: [8766, 819]}}}, 0x69: {l: {0x72: {l: {0x63: {l: {0x3B: {c: [226]}}, c: [226]}}}}}, 0x75: {l: {0x74: {l: {0x65: {l: {0x3B: {c: [180]}}, c: [180]}}}}}, 0x79: {l: {0x3B: {c: [1072]}}}}}, 0x65: {l: {0x6C: {l: {0x69: {l: {0x67: {l: {0x3B: {c: [230]}}, c: [230]}}}}}}}, 0x66: {l: {0x3B: {c: [8289]}, 0x72: {l: {0x3B: {c: [120094]}}}}}, 0x67: {l: {0x72: {l: {0x61: {l: {0x76: {l: {0x65: {l: {0x3B: {c: [224]}}, c: [224]}}}}}}}}}, 0x6C: {l: {0x65: {l: {0x66: {l: {0x73: {l: {0x79: {l: {0x6D: {l: {0x3B: {c: [8501]}}}}}}}}}, 0x70: {l: {0x68: {l: {0x3B: {c: [8501]}}}}}}}, 0x70: {l: {0x68: {l: {0x61: {l: {0x3B: {c: [945]}}}}}}}}}, 0x6D: {l: {0x61: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [257]}}}}}, 0x6C: {l: {0x67: {l: {0x3B: {c: [10815]}}}}}}}, 0x70: {l: {0x3B: {c: [38]}}, c: [38]}}}, 0x6E: {l: {0x64: {l: {0x61: {l: {0x6E: {l: {0x64: {l: {0x3B: {c: [10837]}}}}}}}, 0x3B: {c: [8743]}, 0x64: {l: {0x3B: {c: [10844]}}}, 0x73: {l: {0x6C: {l: {0x6F: {l: {0x70: {l: {0x65: {l: {0x3B: {c: [10840]}}}}}}}}}}}, 0x76: {l: {0x3B: {c: [10842]}}}}}, 0x67: {l: {0x3B: {c: [8736]}, 0x65: {l: {0x3B: {c: [10660]}}}, 0x6C: {l: {0x65: {l: {0x3B: {c: [8736]}}}}}, 0x6D: {l: {0x73: {l: {0x64: {l: {0x61: {l: {0x61: {l: {0x3B: {c: [10664]}}}, 0x62: {l: {0x3B: {c: [10665]}}}, 0x63: {l: {0x3B: {c: [10666]}}}, 0x64: {l: {0x3B: {c: [10667]}}}, 0x65: {l: {0x3B: {c: [10668]}}}, 0x66: {l: {0x3B: {c: [10669]}}}, 0x67: {l: {0x3B: {c: [10670]}}}, 0x68: {l: {0x3B: {c: [10671]}}}}}, 0x3B: {c: [8737]}}}}}}}, 0x72: {l: {0x74: {l: {0x3B: {c: [8735]}, 0x76: {l: {0x62: {l: {0x3B: {c: [8894]}, 0x64: {l: {0x3B: {c: [10653]}}}}}}}}}}}, 0x73: {l: {0x70: {l: {0x68: {l: {0x3B: {c: [8738]}}}}}, 0x74: {l: {0x3B: {c: [197]}}}}}, 0x7A: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x3B: {c: [9084]}}}}}}}}}}}}}, 0x6F: {l: {0x67: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [261]}}}}}}}, 0x70: {l: {0x66: {l: {0x3B: {c: [120146]}}}}}}}, 0x70: {l: {0x61: {l: {0x63: {l: {0x69: {l: {0x72: {l: {0x3B: {c: [10863]}}}}}}}}}, 0x3B: {c: [8776]}, 0x45: {l: {0x3B: {c: [10864]}}}, 0x65: {l: {0x3B: {c: [8778]}}}, 0x69: {l: {0x64: {l: {0x3B: {c: [8779]}}}}}, 0x6F: {l: {0x73: {l: {0x3B: {c: [39]}}}}}, 0x70: {l: {0x72: {l: {0x6F: {l: {0x78: {l: {0x3B: {c: [8776]}, 0x65: {l: {0x71: {l: {0x3B: {c: [8778]}}}}}}}}}}}}}}}, 0x72: {l: {0x69: {l: {0x6E: {l: {0x67: {l: {0x3B: {c: [229]}}, c: [229]}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [119990]}}}}}, 0x74: {l: {0x3B: {c: [42]}}}, 0x79: {l: {0x6D: {l: {0x70: {l: {0x3B: {c: [8776]}, 0x65: {l: {0x71: {l: {0x3B: {c: [8781]}}}}}}}}}}}}}, 0x74: {l: {0x69: {l: {0x6C: {l: {0x64: {l: {0x65: {l: {0x3B: {c: [227]}}, c: [227]}}}}}}}}}, 0x75: {l: {0x6D: {l: {0x6C: {l: {0x3B: {c: [228]}}, c: [228]}}}}}, 0x77: {l: {0x63: {l: {0x6F: {l: {0x6E: {l: {0x69: {l: {0x6E: {l: {0x74: {l: {0x3B: {c: [8755]}}}}}}}}}}}}}, 0x69: {l: {0x6E: {l: {0x74: {l: {0x3B: {c: [10769]}}}}}}}}}}}, | |
0x62: {l: {0x61: {l: {0x63: {l: {0x6B: {l: {0x63: {l: {0x6F: {l: {0x6E: {l: {0x67: {l: {0x3B: {c: [8780]}}}}}}}}}, 0x65: {l: {0x70: {l: {0x73: {l: {0x69: {l: {0x6C: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [1014]}}}}}}}}}}}}}}}, 0x70: {l: {0x72: {l: {0x69: {l: {0x6D: {l: {0x65: {l: {0x3B: {c: [8245]}}}}}}}}}}}, 0x73: {l: {0x69: {l: {0x6D: {l: {0x3B: {c: [8765]}, 0x65: {l: {0x71: {l: {0x3B: {c: [8909]}}}}}}}}}}}}}}}, 0x72: {l: {0x76: {l: {0x65: {l: {0x65: {l: {0x3B: {c: [8893]}}}}}}}, 0x77: {l: {0x65: {l: {0x64: {l: {0x3B: {c: [8965]}, 0x67: {l: {0x65: {l: {0x3B: {c: [8965]}}}}}}}}}}}}}}}, 0x62: {l: {0x72: {l: {0x6B: {l: {0x3B: {c: [9141]}, 0x74: {l: {0x62: {l: {0x72: {l: {0x6B: {l: {0x3B: {c: [9142]}}}}}}}}}}}}}}}, 0x63: {l: {0x6F: {l: {0x6E: {l: {0x67: {l: {0x3B: {c: [8780]}}}}}}}, 0x79: {l: {0x3B: {c: [1073]}}}}}, 0x64: {l: {0x71: {l: {0x75: {l: {0x6F: {l: {0x3B: {c: [8222]}}}}}}}}}, 0x65: {l: {0x63: {l: {0x61: {l: {0x75: {l: {0x73: {l: {0x3B: {c: [8757]}, 0x65: {l: {0x3B: {c: [8757]}}}}}}}}}}}, 0x6D: {l: {0x70: {l: {0x74: {l: {0x79: {l: {0x76: {l: {0x3B: {c: [10672]}}}}}}}}}}}, 0x70: {l: {0x73: {l: {0x69: {l: {0x3B: {c: [1014]}}}}}}}, 0x72: {l: {0x6E: {l: {0x6F: {l: {0x75: {l: {0x3B: {c: [8492]}}}}}}}}}, 0x74: {l: {0x61: {l: {0x3B: {c: [946]}}}, 0x68: {l: {0x3B: {c: [8502]}}}, 0x77: {l: {0x65: {l: {0x65: {l: {0x6E: {l: {0x3B: {c: [8812]}}}}}}}}}}}}}, 0x66: {l: {0x72: {l: {0x3B: {c: [120095]}}}}}, 0x69: {l: {0x67: {l: {0x63: {l: {0x61: {l: {0x70: {l: {0x3B: {c: [8898]}}}}}, 0x69: {l: {0x72: {l: {0x63: {l: {0x3B: {c: [9711]}}}}}}}, 0x75: {l: {0x70: {l: {0x3B: {c: [8899]}}}}}}}, 0x6F: {l: {0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [10752]}}}}}}}, 0x70: {l: {0x6C: {l: {0x75: {l: {0x73: {l: {0x3B: {c: [10753]}}}}}}}}}, 0x74: {l: {0x69: {l: {0x6D: {l: {0x65: {l: {0x73: {l: {0x3B: {c: [10754]}}}}}}}}}}}}}, 0x73: {l: {0x71: {l: {0x63: {l: {0x75: {l: {0x70: {l: {0x3B: {c: [10758]}}}}}}}}}, 0x74: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [9733]}}}}}}}}}, 0x74: {l: {0x72: {l: {0x69: {l: {0x61: {l: {0x6E: {l: {0x67: {l: {0x6C: {l: {0x65: {l: {0x64: {l: {0x6F: {l: {0x77: {l: {0x6E: {l: {0x3B: {c: [9661]}}}}}}}}}, 0x75: {l: {0x70: {l: {0x3B: {c: [9651]}}}}}}}}}}}}}}}}}}}}}, 0x75: {l: {0x70: {l: {0x6C: {l: {0x75: {l: {0x73: {l: {0x3B: {c: [10756]}}}}}}}}}}}, 0x76: {l: {0x65: {l: {0x65: {l: {0x3B: {c: [8897]}}}}}}}, 0x77: {l: {0x65: {l: {0x64: {l: {0x67: {l: {0x65: {l: {0x3B: {c: [8896]}}}}}}}}}}}}}}}, 0x6B: {l: {0x61: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [10509]}}}}}}}}}}}, 0x6C: {l: {0x61: {l: {0x63: {l: {0x6B: {l: {0x6C: {l: {0x6F: {l: {0x7A: {l: {0x65: {l: {0x6E: {l: {0x67: {l: {0x65: {l: {0x3B: {c: [10731]}}}}}}}}}}}}}}}, 0x73: {l: {0x71: {l: {0x75: {l: {0x61: {l: {0x72: {l: {0x65: {l: {0x3B: {c: [9642]}}}}}}}}}}}}}, 0x74: {l: {0x72: {l: {0x69: {l: {0x61: {l: {0x6E: {l: {0x67: {l: {0x6C: {l: {0x65: {l: {0x3B: {c: [9652]}, 0x64: {l: {0x6F: {l: {0x77: {l: {0x6E: {l: {0x3B: {c: [9662]}}}}}}}}}, 0x6C: {l: {0x65: {l: {0x66: {l: {0x74: {l: {0x3B: {c: [9666]}}}}}}}}}, 0x72: {l: {0x69: {l: {0x67: {l: {0x68: {l: {0x74: {l: {0x3B: {c: [9656]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x6E: {l: {0x6B: {l: {0x3B: {c: [9251]}}}}}}}, 0x6B: {l: {0x31: {l: {0x32: {l: {0x3B: {c: [9618]}}}, 0x34: {l: {0x3B: {c: [9617]}}}}}, 0x33: {l: {0x34: {l: {0x3B: {c: [9619]}}}}}}}, 0x6F: {l: {0x63: {l: {0x6B: {l: {0x3B: {c: [9608]}}}}}}}}}, 0x6E: {l: {0x65: {l: {0x3B: {c: [61, 8421]}, 0x71: {l: {0x75: {l: {0x69: {l: {0x76: {l: {0x3B: {c: [8801, 8421]}}}}}}}}}}}, 0x6F: {l: {0x74: {l: {0x3B: {c: [8976]}}}}}}}, 0x4E: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [10989]}}}}}}}, 0x6F: {l: {0x70: {l: {0x66: {l: {0x3B: {c: [120147]}}}}}, 0x74: {l: {0x3B: {c: [8869]}, 0x74: {l: {0x6F: {l: {0x6D: {l: {0x3B: {c: [8869]}}}}}}}}}, 0x77: {l: {0x74: {l: {0x69: {l: {0x65: {l: {0x3B: {c: [8904]}}}}}}}}}, 0x78: {l: {0x62: {l: {0x6F: {l: {0x78: {l: {0x3B: {c: [10697]}}}}}}}, 0x64: {l: {0x6C: {l: {0x3B: {c: [9488]}}}, 0x4C: {l: {0x3B: {c: [9557]}}}, 0x72: {l: {0x3B: {c: [9484]}}}, 0x52: {l: {0x3B: {c: [9554]}}}}}, 0x44: {l: {0x6C: {l: {0x3B: {c: [9558]}}}, 0x4C: {l: {0x3B: {c: [9559]}}}, 0x72: {l: {0x3B: {c: [9555]}}}, 0x52: {l: {0x3B: {c: [9556]}}}}}, 0x68: {l: {0x3B: {c: [9472]}, 0x64: {l: {0x3B: {c: [9516]}}}, 0x44: {l: {0x3B: {c: [9573]}}}, 0x75: {l: {0x3B: {c: [9524]}}}, 0x55: {l: {0x3B: {c: [9576]}}}}}, 0x48: {l: {0x3B: {c: [9552]}, 0x64: {l: {0x3B: {c: [9572]}}}, 0x44: {l: {0x3B: {c: [9574]}}}, 0x75: {l: {0x3B: {c: [9575]}}}, 0x55: {l: {0x3B: {c: [9577]}}}}}, 0x6D: {l: {0x69: {l: {0x6E: {l: {0x75: {l: {0x73: {l: {0x3B: {c: [8863]}}}}}}}}}}}, 0x70: {l: {0x6C: {l: {0x75: {l: {0x73: {l: {0x3B: {c: [8862]}}}}}}}}}, 0x74: {l: {0x69: {l: {0x6D: {l: {0x65: {l: {0x73: {l: {0x3B: {c: [8864]}}}}}}}}}}}, 0x75: {l: {0x6C: {l: {0x3B: {c: [9496]}}}, 0x4C: {l: {0x3B: {c: [9563]}}}, 0x72: {l: {0x3B: {c: [9492]}}}, 0x52: {l: {0x3B: {c: [9560]}}}}}, 0x55: {l: {0x6C: {l: {0x3B: {c: [9564]}}}, 0x4C: {l: {0x3B: {c: [9565]}}}, 0x72: {l: {0x3B: {c: [9561]}}}, 0x52: {l: {0x3B: {c: [9562]}}}}}, 0x76: {l: {0x3B: {c: [9474]}, 0x68: {l: {0x3B: {c: [9532]}}}, 0x48: {l: {0x3B: {c: [9578]}}}, 0x6C: {l: {0x3B: {c: [9508]}}}, 0x4C: {l: {0x3B: {c: [9569]}}}, 0x72: {l: {0x3B: {c: [9500]}}}, 0x52: {l: {0x3B: {c: [9566]}}}}}, 0x56: {l: {0x3B: {c: [9553]}, 0x68: {l: {0x3B: {c: [9579]}}}, 0x48: {l: {0x3B: {c: [9580]}}}, 0x6C: {l: {0x3B: {c: [9570]}}}, 0x4C: {l: {0x3B: {c: [9571]}}}, 0x72: {l: {0x3B: {c: [9567]}}}, 0x52: {l: {0x3B: {c: [9568]}}}}}}}}}, 0x70: {l: {0x72: {l: {0x69: {l: {0x6D: {l: {0x65: {l: {0x3B: {c: [8245]}}}}}}}}}}}, 0x72: {l: {0x65: {l: {0x76: {l: {0x65: {l: {0x3B: {c: [728]}}}}}}}, 0x76: {l: {0x62: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [166]}}, c: [166]}}}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [119991]}}}}}, 0x65: {l: {0x6D: {l: {0x69: {l: {0x3B: {c: [8271]}}}}}}}, 0x69: {l: {0x6D: {l: {0x3B: {c: [8765]}, 0x65: {l: {0x3B: {c: [8909]}}}}}}}, 0x6F: {l: {0x6C: {l: {0x62: {l: {0x3B: {c: [10693]}}}, 0x3B: {c: [92]}, 0x68: {l: {0x73: {l: {0x75: {l: {0x62: {l: {0x3B: {c: [10184]}}}}}}}}}}}}}}}, 0x75: {l: {0x6C: {l: {0x6C: {l: {0x3B: {c: [8226]}, 0x65: {l: {0x74: {l: {0x3B: {c: [8226]}}}}}}}}}, 0x6D: {l: {0x70: {l: {0x3B: {c: [8782]}, 0x45: {l: {0x3B: {c: [10926]}}}, 0x65: {l: {0x3B: {c: [8783]}, 0x71: {l: {0x3B: {c: [8783]}}}}}}}}}}}}}, | |
0x42: {l: {0x61: {l: {0x63: {l: {0x6B: {l: {0x73: {l: {0x6C: {l: {0x61: {l: {0x73: {l: {0x68: {l: {0x3B: {c: [8726]}}}}}}}}}}}}}}}, 0x72: {l: {0x76: {l: {0x3B: {c: [10983]}}}, 0x77: {l: {0x65: {l: {0x64: {l: {0x3B: {c: [8966]}}}}}}}}}}}, 0x63: {l: {0x79: {l: {0x3B: {c: [1041]}}}}}, 0x65: {l: {0x63: {l: {0x61: {l: {0x75: {l: {0x73: {l: {0x65: {l: {0x3B: {c: [8757]}}}}}}}}}}}, 0x72: {l: {0x6E: {l: {0x6F: {l: {0x75: {l: {0x6C: {l: {0x6C: {l: {0x69: {l: {0x73: {l: {0x3B: {c: [8492]}}}}}}}}}}}}}}}}}, 0x74: {l: {0x61: {l: {0x3B: {c: [914]}}}}}}}, 0x66: {l: {0x72: {l: {0x3B: {c: [120069]}}}}}, 0x6F: {l: {0x70: {l: {0x66: {l: {0x3B: {c: [120121]}}}}}}}, 0x72: {l: {0x65: {l: {0x76: {l: {0x65: {l: {0x3B: {c: [728]}}}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [8492]}}}}}}}, 0x75: {l: {0x6D: {l: {0x70: {l: {0x65: {l: {0x71: {l: {0x3B: {c: [8782]}}}}}}}}}}}}}, | |
0x43: {l: {0x61: {l: {0x63: {l: {0x75: {l: {0x74: {l: {0x65: {l: {0x3B: {c: [262]}}}}}}}}}, 0x70: {l: {0x3B: {c: [8914]}, 0x69: {l: {0x74: {l: {0x61: {l: {0x6C: {l: {0x44: {l: {0x69: {l: {0x66: {l: {0x66: {l: {0x65: {l: {0x72: {l: {0x65: {l: {0x6E: {l: {0x74: {l: {0x69: {l: {0x61: {l: {0x6C: {l: {0x44: {l: {0x3B: {c: [8517]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x79: {l: {0x6C: {l: {0x65: {l: {0x79: {l: {0x73: {l: {0x3B: {c: [8493]}}}}}}}}}}}}}, 0x63: {l: {0x61: {l: {0x72: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [268]}}}}}}}}}, 0x65: {l: {0x64: {l: {0x69: {l: {0x6C: {l: {0x3B: {c: [199]}}, c: [199]}}}}}}}, 0x69: {l: {0x72: {l: {0x63: {l: {0x3B: {c: [264]}}}}}}}, 0x6F: {l: {0x6E: {l: {0x69: {l: {0x6E: {l: {0x74: {l: {0x3B: {c: [8752]}}}}}}}}}}}}}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [266]}}}}}}}, 0x65: {l: {0x64: {l: {0x69: {l: {0x6C: {l: {0x6C: {l: {0x61: {l: {0x3B: {c: [184]}}}}}}}}}}}, 0x6E: {l: {0x74: {l: {0x65: {l: {0x72: {l: {0x44: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [183]}}}}}}}}}}}}}}}}}, 0x66: {l: {0x72: {l: {0x3B: {c: [8493]}}}}}, 0x48: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1063]}}}}}}}, 0x68: {l: {0x69: {l: {0x3B: {c: [935]}}}}}, 0x69: {l: {0x72: {l: {0x63: {l: {0x6C: {l: {0x65: {l: {0x44: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [8857]}}}}}}}, 0x4D: {l: {0x69: {l: {0x6E: {l: {0x75: {l: {0x73: {l: {0x3B: {c: [8854]}}}}}}}}}}}, 0x50: {l: {0x6C: {l: {0x75: {l: {0x73: {l: {0x3B: {c: [8853]}}}}}}}}}, 0x54: {l: {0x69: {l: {0x6D: {l: {0x65: {l: {0x73: {l: {0x3B: {c: [8855]}}}}}}}}}}}}}}}}}}}}}, 0x6C: {l: {0x6F: {l: {0x63: {l: {0x6B: {l: {0x77: {l: {0x69: {l: {0x73: {l: {0x65: {l: {0x43: {l: {0x6F: {l: {0x6E: {l: {0x74: {l: {0x6F: {l: {0x75: {l: {0x72: {l: {0x49: {l: {0x6E: {l: {0x74: {l: {0x65: {l: {0x67: {l: {0x72: {l: {0x61: {l: {0x6C: {l: {0x3B: {c: [8754]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x73: {l: {0x65: {l: {0x43: {l: {0x75: {l: {0x72: {l: {0x6C: {l: {0x79: {l: {0x44: {l: {0x6F: {l: {0x75: {l: {0x62: {l: {0x6C: {l: {0x65: {l: {0x51: {l: {0x75: {l: {0x6F: {l: {0x74: {l: {0x65: {l: {0x3B: {c: [8221]}}}}}}}}}}}}}}}}}}}}}}}, 0x51: {l: {0x75: {l: {0x6F: {l: {0x74: {l: {0x65: {l: {0x3B: {c: [8217]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x6F: {l: {0x6C: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [8759]}, 0x65: {l: {0x3B: {c: [10868]}}}}}}}}}, 0x6E: {l: {0x67: {l: {0x72: {l: {0x75: {l: {0x65: {l: {0x6E: {l: {0x74: {l: {0x3B: {c: [8801]}}}}}}}}}}}}}, 0x69: {l: {0x6E: {l: {0x74: {l: {0x3B: {c: [8751]}}}}}}}, 0x74: {l: {0x6F: {l: {0x75: {l: {0x72: {l: {0x49: {l: {0x6E: {l: {0x74: {l: {0x65: {l: {0x67: {l: {0x72: {l: {0x61: {l: {0x6C: {l: {0x3B: {c: [8750]}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x70: {l: {0x66: {l: {0x3B: {c: [8450]}}}, 0x72: {l: {0x6F: {l: {0x64: {l: {0x75: {l: {0x63: {l: {0x74: {l: {0x3B: {c: [8720]}}}}}}}}}}}}}}}, 0x75: {l: {0x6E: {l: {0x74: {l: {0x65: {l: {0x72: {l: {0x43: {l: {0x6C: {l: {0x6F: {l: {0x63: {l: {0x6B: {l: {0x77: {l: {0x69: {l: {0x73: {l: {0x65: {l: {0x43: {l: {0x6F: {l: {0x6E: {l: {0x74: {l: {0x6F: {l: {0x75: {l: {0x72: {l: {0x49: {l: {0x6E: {l: {0x74: {l: {0x65: {l: {0x67: {l: {0x72: {l: {0x61: {l: {0x6C: {l: {0x3B: {c: [8755]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x4F: {l: {0x50: {l: {0x59: {l: {0x3B: {c: [169]}}, c: [169]}}}}}, 0x72: {l: {0x6F: {l: {0x73: {l: {0x73: {l: {0x3B: {c: [10799]}}}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [119966]}}}}}}}, 0x75: {l: {0x70: {l: {0x43: {l: {0x61: {l: {0x70: {l: {0x3B: {c: [8781]}}}}}}}, 0x3B: {c: [8915]}}}}}}}, | |
0x63: {l: {0x61: {l: {0x63: {l: {0x75: {l: {0x74: {l: {0x65: {l: {0x3B: {c: [263]}}}}}}}}}, 0x70: {l: {0x61: {l: {0x6E: {l: {0x64: {l: {0x3B: {c: [10820]}}}}}}}, 0x62: {l: {0x72: {l: {0x63: {l: {0x75: {l: {0x70: {l: {0x3B: {c: [10825]}}}}}}}}}}}, 0x63: {l: {0x61: {l: {0x70: {l: {0x3B: {c: [10827]}}}}}, 0x75: {l: {0x70: {l: {0x3B: {c: [10823]}}}}}}}, 0x3B: {c: [8745]}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [10816]}}}}}}}, 0x73: {l: {0x3B: {c: [8745, 65024]}}}}}, 0x72: {l: {0x65: {l: {0x74: {l: {0x3B: {c: [8257]}}}}}, 0x6F: {l: {0x6E: {l: {0x3B: {c: [711]}}}}}}}}}, 0x63: {l: {0x61: {l: {0x70: {l: {0x73: {l: {0x3B: {c: [10829]}}}}}, 0x72: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [269]}}}}}}}}}, 0x65: {l: {0x64: {l: {0x69: {l: {0x6C: {l: {0x3B: {c: [231]}}, c: [231]}}}}}}}, 0x69: {l: {0x72: {l: {0x63: {l: {0x3B: {c: [265]}}}}}}}, 0x75: {l: {0x70: {l: {0x73: {l: {0x3B: {c: [10828]}, 0x73: {l: {0x6D: {l: {0x3B: {c: [10832]}}}}}}}}}}}}}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [267]}}}}}}}, 0x65: {l: {0x64: {l: {0x69: {l: {0x6C: {l: {0x3B: {c: [184]}}, c: [184]}}}}}, 0x6D: {l: {0x70: {l: {0x74: {l: {0x79: {l: {0x76: {l: {0x3B: {c: [10674]}}}}}}}}}}}, 0x6E: {l: {0x74: {l: {0x3B: {c: [162]}, 0x65: {l: {0x72: {l: {0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [183]}}}}}}}}}}}}, c: [162]}}}}}, 0x66: {l: {0x72: {l: {0x3B: {c: [120096]}}}}}, 0x68: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1095]}}}}}, 0x65: {l: {0x63: {l: {0x6B: {l: {0x3B: {c: [10003]}, 0x6D: {l: {0x61: {l: {0x72: {l: {0x6B: {l: {0x3B: {c: [10003]}}}}}}}}}}}}}}}, 0x69: {l: {0x3B: {c: [967]}}}}}, 0x69: {l: {0x72: {l: {0x63: {l: {0x3B: {c: [710]}, 0x65: {l: {0x71: {l: {0x3B: {c: [8791]}}}}}, 0x6C: {l: {0x65: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x6C: {l: {0x65: {l: {0x66: {l: {0x74: {l: {0x3B: {c: [8634]}}}}}}}}}, 0x72: {l: {0x69: {l: {0x67: {l: {0x68: {l: {0x74: {l: {0x3B: {c: [8635]}}}}}}}}}}}}}}}}}}}}}, 0x64: {l: {0x61: {l: {0x73: {l: {0x74: {l: {0x3B: {c: [8859]}}}}}}}, 0x63: {l: {0x69: {l: {0x72: {l: {0x63: {l: {0x3B: {c: [8858]}}}}}}}}}, 0x64: {l: {0x61: {l: {0x73: {l: {0x68: {l: {0x3B: {c: [8861]}}}}}}}}}, 0x52: {l: {0x3B: {c: [174]}}}, 0x53: {l: {0x3B: {c: [9416]}}}}}}}}}}}, 0x3B: {c: [9675]}, 0x45: {l: {0x3B: {c: [10691]}}}, 0x65: {l: {0x3B: {c: [8791]}}}, 0x66: {l: {0x6E: {l: {0x69: {l: {0x6E: {l: {0x74: {l: {0x3B: {c: [10768]}}}}}}}}}}}, 0x6D: {l: {0x69: {l: {0x64: {l: {0x3B: {c: [10991]}}}}}}}, 0x73: {l: {0x63: {l: {0x69: {l: {0x72: {l: {0x3B: {c: [10690]}}}}}}}}}}}}}, 0x6C: {l: {0x75: {l: {0x62: {l: {0x73: {l: {0x3B: {c: [9827]}, 0x75: {l: {0x69: {l: {0x74: {l: {0x3B: {c: [9827]}}}}}}}}}}}}}}}, 0x6F: {l: {0x6C: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [58]}, 0x65: {l: {0x3B: {c: [8788]}, 0x71: {l: {0x3B: {c: [8788]}}}}}}}}}}}, 0x6D: {l: {0x6D: {l: {0x61: {l: {0x3B: {c: [44]}, 0x74: {l: {0x3B: {c: [64]}}}}}}}, 0x70: {l: {0x3B: {c: [8705]}, 0x66: {l: {0x6E: {l: {0x3B: {c: [8728]}}}}}, 0x6C: {l: {0x65: {l: {0x6D: {l: {0x65: {l: {0x6E: {l: {0x74: {l: {0x3B: {c: [8705]}}}}}}}}}, 0x78: {l: {0x65: {l: {0x73: {l: {0x3B: {c: [8450]}}}}}}}}}}}}}}}, 0x6E: {l: {0x67: {l: {0x3B: {c: [8773]}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [10861]}}}}}}}}}, 0x69: {l: {0x6E: {l: {0x74: {l: {0x3B: {c: [8750]}}}}}}}}}, 0x70: {l: {0x66: {l: {0x3B: {c: [120148]}}}, 0x72: {l: {0x6F: {l: {0x64: {l: {0x3B: {c: [8720]}}}}}}}, 0x79: {l: {0x3B: {c: [169]}, 0x73: {l: {0x72: {l: {0x3B: {c: [8471]}}}}}}, c: [169]}}}}}, 0x72: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x3B: {c: [8629]}}}}}}}, 0x6F: {l: {0x73: {l: {0x73: {l: {0x3B: {c: [10007]}}}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [119992]}}}}}, 0x75: {l: {0x62: {l: {0x3B: {c: [10959]}, 0x65: {l: {0x3B: {c: [10961]}}}}}, 0x70: {l: {0x3B: {c: [10960]}, 0x65: {l: {0x3B: {c: [10962]}}}}}}}}}, 0x74: {l: {0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [8943]}}}}}}}}}, 0x75: {l: {0x64: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x6C: {l: {0x3B: {c: [10552]}}}, 0x72: {l: {0x3B: {c: [10549]}}}}}}}}}}}, 0x65: {l: {0x70: {l: {0x72: {l: {0x3B: {c: [8926]}}}}}, 0x73: {l: {0x63: {l: {0x3B: {c: [8927]}}}}}}}, 0x6C: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x3B: {c: [8630]}, 0x70: {l: {0x3B: {c: [10557]}}}}}}}}}}}, 0x70: {l: {0x62: {l: {0x72: {l: {0x63: {l: {0x61: {l: {0x70: {l: {0x3B: {c: [10824]}}}}}}}}}}}, 0x63: {l: {0x61: {l: {0x70: {l: {0x3B: {c: [10822]}}}}}, 0x75: {l: {0x70: {l: {0x3B: {c: [10826]}}}}}}}, 0x3B: {c: [8746]}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [8845]}}}}}}}, 0x6F: {l: {0x72: {l: {0x3B: {c: [10821]}}}}}, 0x73: {l: {0x3B: {c: [8746, 65024]}}}}}, 0x72: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x3B: {c: [8631]}, 0x6D: {l: {0x3B: {c: [10556]}}}}}}}}}, 0x6C: {l: {0x79: {l: {0x65: {l: {0x71: {l: {0x70: {l: {0x72: {l: {0x65: {l: {0x63: {l: {0x3B: {c: [8926]}}}}}}}}}, 0x73: {l: {0x75: {l: {0x63: {l: {0x63: {l: {0x3B: {c: [8927]}}}}}}}}}}}}}, 0x76: {l: {0x65: {l: {0x65: {l: {0x3B: {c: [8910]}}}}}}}, 0x77: {l: {0x65: {l: {0x64: {l: {0x67: {l: {0x65: {l: {0x3B: {c: [8911]}}}}}}}}}}}}}}}, 0x72: {l: {0x65: {l: {0x6E: {l: {0x3B: {c: [164]}}, c: [164]}}}}}, 0x76: {l: {0x65: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x6C: {l: {0x65: {l: {0x66: {l: {0x74: {l: {0x3B: {c: [8630]}}}}}}}}}, 0x72: {l: {0x69: {l: {0x67: {l: {0x68: {l: {0x74: {l: {0x3B: {c: [8631]}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x76: {l: {0x65: {l: {0x65: {l: {0x3B: {c: [8910]}}}}}}}, 0x77: {l: {0x65: {l: {0x64: {l: {0x3B: {c: [8911]}}}}}}}}}, 0x77: {l: {0x63: {l: {0x6F: {l: {0x6E: {l: {0x69: {l: {0x6E: {l: {0x74: {l: {0x3B: {c: [8754]}}}}}}}}}}}}}, 0x69: {l: {0x6E: {l: {0x74: {l: {0x3B: {c: [8753]}}}}}}}}}, 0x79: {l: {0x6C: {l: {0x63: {l: {0x74: {l: {0x79: {l: {0x3B: {c: [9005]}}}}}}}}}}}}}, | |
0x64: {l: {0x61: {l: {0x67: {l: {0x67: {l: {0x65: {l: {0x72: {l: {0x3B: {c: [8224]}}}}}}}}}, 0x6C: {l: {0x65: {l: {0x74: {l: {0x68: {l: {0x3B: {c: [8504]}}}}}}}}}, 0x72: {l: {0x72: {l: {0x3B: {c: [8595]}}}}}, 0x73: {l: {0x68: {l: {0x3B: {c: [8208]}, 0x76: {l: {0x3B: {c: [8867]}}}}}}}}}, 0x41: {l: {0x72: {l: {0x72: {l: {0x3B: {c: [8659]}}}}}}}, 0x62: {l: {0x6B: {l: {0x61: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [10511]}}}}}}}}}}}, 0x6C: {l: {0x61: {l: {0x63: {l: {0x3B: {c: [733]}}}}}}}}}, 0x63: {l: {0x61: {l: {0x72: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [271]}}}}}}}}}, 0x79: {l: {0x3B: {c: [1076]}}}}}, 0x64: {l: {0x61: {l: {0x67: {l: {0x67: {l: {0x65: {l: {0x72: {l: {0x3B: {c: [8225]}}}}}}}}}, 0x72: {l: {0x72: {l: {0x3B: {c: [8650]}}}}}}}, 0x3B: {c: [8518]}, 0x6F: {l: {0x74: {l: {0x73: {l: {0x65: {l: {0x71: {l: {0x3B: {c: [10871]}}}}}}}}}}}}}, 0x65: {l: {0x67: {l: {0x3B: {c: [176]}}, c: [176]}, 0x6C: {l: {0x74: {l: {0x61: {l: {0x3B: {c: [948]}}}}}}}, 0x6D: {l: {0x70: {l: {0x74: {l: {0x79: {l: {0x76: {l: {0x3B: {c: [10673]}}}}}}}}}}}}}, 0x66: {l: {0x69: {l: {0x73: {l: {0x68: {l: {0x74: {l: {0x3B: {c: [10623]}}}}}}}}}, 0x72: {l: {0x3B: {c: [120097]}}}}}, 0x48: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [10597]}}}}}}}, 0x68: {l: {0x61: {l: {0x72: {l: {0x6C: {l: {0x3B: {c: [8643]}}}, 0x72: {l: {0x3B: {c: [8642]}}}}}}}}}, 0x69: {l: {0x61: {l: {0x6D: {l: {0x3B: {c: [8900]}, 0x6F: {l: {0x6E: {l: {0x64: {l: {0x3B: {c: [8900]}, 0x73: {l: {0x75: {l: {0x69: {l: {0x74: {l: {0x3B: {c: [9830]}}}}}}}}}}}}}}}, 0x73: {l: {0x3B: {c: [9830]}}}}}}}, 0x65: {l: {0x3B: {c: [168]}}}, 0x67: {l: {0x61: {l: {0x6D: {l: {0x6D: {l: {0x61: {l: {0x3B: {c: [989]}}}}}}}}}}}, 0x73: {l: {0x69: {l: {0x6E: {l: {0x3B: {c: [8946]}}}}}}}, 0x76: {l: {0x3B: {c: [247]}, 0x69: {l: {0x64: {l: {0x65: {l: {0x3B: {c: [247]}, 0x6F: {l: {0x6E: {l: {0x74: {l: {0x69: {l: {0x6D: {l: {0x65: {l: {0x73: {l: {0x3B: {c: [8903]}}}}}}}}}}}}}}}}, c: [247]}}}}}, 0x6F: {l: {0x6E: {l: {0x78: {l: {0x3B: {c: [8903]}}}}}}}}}}}, 0x6A: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1106]}}}}}}}, 0x6C: {l: {0x63: {l: {0x6F: {l: {0x72: {l: {0x6E: {l: {0x3B: {c: [8990]}}}}}}}, 0x72: {l: {0x6F: {l: {0x70: {l: {0x3B: {c: [8973]}}}}}}}}}}}, 0x6F: {l: {0x6C: {l: {0x6C: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [36]}}}}}}}}}, 0x70: {l: {0x66: {l: {0x3B: {c: [120149]}}}}}, 0x74: {l: {0x3B: {c: [729]}, 0x65: {l: {0x71: {l: {0x3B: {c: [8784]}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [8785]}}}}}}}}}}}, 0x6D: {l: {0x69: {l: {0x6E: {l: {0x75: {l: {0x73: {l: {0x3B: {c: [8760]}}}}}}}}}}}, 0x70: {l: {0x6C: {l: {0x75: {l: {0x73: {l: {0x3B: {c: [8724]}}}}}}}}}, 0x73: {l: {0x71: {l: {0x75: {l: {0x61: {l: {0x72: {l: {0x65: {l: {0x3B: {c: [8865]}}}}}}}}}}}}}}}, 0x75: {l: {0x62: {l: {0x6C: {l: {0x65: {l: {0x62: {l: {0x61: {l: {0x72: {l: {0x77: {l: {0x65: {l: {0x64: {l: {0x67: {l: {0x65: {l: {0x3B: {c: [8966]}}}}}}}}}}}}}}}}}}}}}}}}}, 0x77: {l: {0x6E: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8595]}}}}}}}}}}}, 0x64: {l: {0x6F: {l: {0x77: {l: {0x6E: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x73: {l: {0x3B: {c: [8650]}}}}}}}}}}}}}}}}}}}}}, 0x68: {l: {0x61: {l: {0x72: {l: {0x70: {l: {0x6F: {l: {0x6F: {l: {0x6E: {l: {0x6C: {l: {0x65: {l: {0x66: {l: {0x74: {l: {0x3B: {c: [8643]}}}}}}}}}, 0x72: {l: {0x69: {l: {0x67: {l: {0x68: {l: {0x74: {l: {0x3B: {c: [8642]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x72: {l: {0x62: {l: {0x6B: {l: {0x61: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [10512]}}}}}}}}}}}}}, 0x63: {l: {0x6F: {l: {0x72: {l: {0x6E: {l: {0x3B: {c: [8991]}}}}}}}, 0x72: {l: {0x6F: {l: {0x70: {l: {0x3B: {c: [8972]}}}}}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [119993]}}}, 0x79: {l: {0x3B: {c: [1109]}}}}}, 0x6F: {l: {0x6C: {l: {0x3B: {c: [10742]}}}}}, 0x74: {l: {0x72: {l: {0x6F: {l: {0x6B: {l: {0x3B: {c: [273]}}}}}}}}}}}, 0x74: {l: {0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [8945]}}}}}}}, 0x72: {l: {0x69: {l: {0x3B: {c: [9663]}, 0x66: {l: {0x3B: {c: [9662]}}}}}}}}}, 0x75: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x3B: {c: [8693]}}}}}}}, 0x68: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [10607]}}}}}}}}}, 0x77: {l: {0x61: {l: {0x6E: {l: {0x67: {l: {0x6C: {l: {0x65: {l: {0x3B: {c: [10662]}}}}}}}}}}}}}, 0x7A: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1119]}}}}}, 0x69: {l: {0x67: {l: {0x72: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x3B: {c: [10239]}}}}}}}}}}}}}}}}}, | |
0x44: {l: {0x61: {l: {0x67: {l: {0x67: {l: {0x65: {l: {0x72: {l: {0x3B: {c: [8225]}}}}}}}}}, 0x72: {l: {0x72: {l: {0x3B: {c: [8609]}}}}}, 0x73: {l: {0x68: {l: {0x76: {l: {0x3B: {c: [10980]}}}}}}}}}, 0x63: {l: {0x61: {l: {0x72: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [270]}}}}}}}}}, 0x79: {l: {0x3B: {c: [1044]}}}}}, 0x44: {l: {0x3B: {c: [8517]}, 0x6F: {l: {0x74: {l: {0x72: {l: {0x61: {l: {0x68: {l: {0x64: {l: {0x3B: {c: [10513]}}}}}}}}}}}}}}}, 0x65: {l: {0x6C: {l: {0x3B: {c: [8711]}, 0x74: {l: {0x61: {l: {0x3B: {c: [916]}}}}}}}}}, 0x66: {l: {0x72: {l: {0x3B: {c: [120071]}}}}}, 0x69: {l: {0x61: {l: {0x63: {l: {0x72: {l: {0x69: {l: {0x74: {l: {0x69: {l: {0x63: {l: {0x61: {l: {0x6C: {l: {0x41: {l: {0x63: {l: {0x75: {l: {0x74: {l: {0x65: {l: {0x3B: {c: [180]}}}}}}}}}}}, 0x44: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [729]}}}, 0x75: {l: {0x62: {l: {0x6C: {l: {0x65: {l: {0x41: {l: {0x63: {l: {0x75: {l: {0x74: {l: {0x65: {l: {0x3B: {c: [733]}}}}}}}}}}}}}}}}}}}}}}}, 0x47: {l: {0x72: {l: {0x61: {l: {0x76: {l: {0x65: {l: {0x3B: {c: [96]}}}}}}}}}}}, 0x54: {l: {0x69: {l: {0x6C: {l: {0x64: {l: {0x65: {l: {0x3B: {c: [732]}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x6D: {l: {0x6F: {l: {0x6E: {l: {0x64: {l: {0x3B: {c: [8900]}}}}}}}}}}}, 0x66: {l: {0x66: {l: {0x65: {l: {0x72: {l: {0x65: {l: {0x6E: {l: {0x74: {l: {0x69: {l: {0x61: {l: {0x6C: {l: {0x44: {l: {0x3B: {c: [8518]}}}}}}}}}}}}}}}}}}}}}}}}}, 0x4A: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1026]}}}}}}}, 0x6F: {l: {0x70: {l: {0x66: {l: {0x3B: {c: [120123]}}}}}, 0x74: {l: {0x3B: {c: [168]}, 0x44: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [8412]}}}}}}}, 0x45: {l: {0x71: {l: {0x75: {l: {0x61: {l: {0x6C: {l: {0x3B: {c: [8784]}}}}}}}}}}}}}, 0x75: {l: {0x62: {l: {0x6C: {l: {0x65: {l: {0x43: {l: {0x6F: {l: {0x6E: {l: {0x74: {l: {0x6F: {l: {0x75: {l: {0x72: {l: {0x49: {l: {0x6E: {l: {0x74: {l: {0x65: {l: {0x67: {l: {0x72: {l: {0x61: {l: {0x6C: {l: {0x3B: {c: [8751]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x44: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [168]}}}, 0x77: {l: {0x6E: {l: {0x41: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8659]}}}}}}}}}}}}}}}}}}}, 0x4C: {l: {0x65: {l: {0x66: {l: {0x74: {l: {0x41: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8656]}}}}}}}}}}}, 0x52: {l: {0x69: {l: {0x67: {l: {0x68: {l: {0x74: {l: {0x41: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8660]}}}}}}}}}}}}}}}}}}}}}, 0x54: {l: {0x65: {l: {0x65: {l: {0x3B: {c: [10980]}}}}}}}}}}}}}, 0x6F: {l: {0x6E: {l: {0x67: {l: {0x4C: {l: {0x65: {l: {0x66: {l: {0x74: {l: {0x41: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [10232]}}}}}}}}}}}, 0x52: {l: {0x69: {l: {0x67: {l: {0x68: {l: {0x74: {l: {0x41: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [10234]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x52: {l: {0x69: {l: {0x67: {l: {0x68: {l: {0x74: {l: {0x41: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [10233]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x52: {l: {0x69: {l: {0x67: {l: {0x68: {l: {0x74: {l: {0x41: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8658]}}}}}}}}}}}, 0x54: {l: {0x65: {l: {0x65: {l: {0x3B: {c: [8872]}}}}}}}}}}}}}}}}}, 0x55: {l: {0x70: {l: {0x41: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8657]}}}}}}}}}}}, 0x44: {l: {0x6F: {l: {0x77: {l: {0x6E: {l: {0x41: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8661]}}}}}}}}}}}}}}}}}}}}}}}, 0x56: {l: {0x65: {l: {0x72: {l: {0x74: {l: {0x69: {l: {0x63: {l: {0x61: {l: {0x6C: {l: {0x42: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [8741]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x77: {l: {0x6E: {l: {0x41: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x42: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [10515]}}}}}}}, 0x3B: {c: [8595]}, 0x55: {l: {0x70: {l: {0x41: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8693]}}}}}}}}}}}}}}}}}}}}}}}}}, 0x61: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8659]}}}}}}}}}}}, 0x42: {l: {0x72: {l: {0x65: {l: {0x76: {l: {0x65: {l: {0x3B: {c: [785]}}}}}}}}}}}, 0x4C: {l: {0x65: {l: {0x66: {l: {0x74: {l: {0x52: {l: {0x69: {l: {0x67: {l: {0x68: {l: {0x74: {l: {0x56: {l: {0x65: {l: {0x63: {l: {0x74: {l: {0x6F: {l: {0x72: {l: {0x3B: {c: [10576]}}}}}}}}}}}}}}}}}}}}}}}, 0x54: {l: {0x65: {l: {0x65: {l: {0x56: {l: {0x65: {l: {0x63: {l: {0x74: {l: {0x6F: {l: {0x72: {l: {0x3B: {c: [10590]}}}}}}}}}}}}}}}}}}}, 0x56: {l: {0x65: {l: {0x63: {l: {0x74: {l: {0x6F: {l: {0x72: {l: {0x42: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [10582]}}}}}}}, 0x3B: {c: [8637]}}}}}}}}}}}}}}}}}}}}}, 0x52: {l: {0x69: {l: {0x67: {l: {0x68: {l: {0x74: {l: {0x54: {l: {0x65: {l: {0x65: {l: {0x56: {l: {0x65: {l: {0x63: {l: {0x74: {l: {0x6F: {l: {0x72: {l: {0x3B: {c: [10591]}}}}}}}}}}}}}}}}}}}, 0x56: {l: {0x65: {l: {0x63: {l: {0x74: {l: {0x6F: {l: {0x72: {l: {0x42: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [10583]}}}}}}}, 0x3B: {c: [8641]}}}}}}}}}}}}}}}}}}}}}}}, 0x54: {l: {0x65: {l: {0x65: {l: {0x41: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8615]}}}}}}}}}}}, 0x3B: {c: [8868]}}}}}}}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [119967]}}}}}, 0x74: {l: {0x72: {l: {0x6F: {l: {0x6B: {l: {0x3B: {c: [272]}}}}}}}}}}}, 0x53: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1029]}}}}}}}, 0x5A: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1039]}}}}}}}}}, | |
0x45: {l: {0x61: {l: {0x63: {l: {0x75: {l: {0x74: {l: {0x65: {l: {0x3B: {c: [201]}}, c: [201]}}}}}}}}}, 0x63: {l: {0x61: {l: {0x72: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [282]}}}}}}}}}, 0x69: {l: {0x72: {l: {0x63: {l: {0x3B: {c: [202]}}, c: [202]}}}}}, 0x79: {l: {0x3B: {c: [1069]}}}}}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [278]}}}}}}}, 0x66: {l: {0x72: {l: {0x3B: {c: [120072]}}}}}, 0x67: {l: {0x72: {l: {0x61: {l: {0x76: {l: {0x65: {l: {0x3B: {c: [200]}}, c: [200]}}}}}}}}}, 0x6C: {l: {0x65: {l: {0x6D: {l: {0x65: {l: {0x6E: {l: {0x74: {l: {0x3B: {c: [8712]}}}}}}}}}}}}}, 0x6D: {l: {0x61: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [274]}}}}}}}, 0x70: {l: {0x74: {l: {0x79: {l: {0x53: {l: {0x6D: {l: {0x61: {l: {0x6C: {l: {0x6C: {l: {0x53: {l: {0x71: {l: {0x75: {l: {0x61: {l: {0x72: {l: {0x65: {l: {0x3B: {c: [9723]}}}}}}}}}}}}}}}}}}}}}}}, 0x56: {l: {0x65: {l: {0x72: {l: {0x79: {l: {0x53: {l: {0x6D: {l: {0x61: {l: {0x6C: {l: {0x6C: {l: {0x53: {l: {0x71: {l: {0x75: {l: {0x61: {l: {0x72: {l: {0x65: {l: {0x3B: {c: [9643]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x4E: {l: {0x47: {l: {0x3B: {c: [330]}}}}}, 0x6F: {l: {0x67: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [280]}}}}}}}, 0x70: {l: {0x66: {l: {0x3B: {c: [120124]}}}}}}}, 0x70: {l: {0x73: {l: {0x69: {l: {0x6C: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [917]}}}}}}}}}}}}}, 0x71: {l: {0x75: {l: {0x61: {l: {0x6C: {l: {0x3B: {c: [10869]}, 0x54: {l: {0x69: {l: {0x6C: {l: {0x64: {l: {0x65: {l: {0x3B: {c: [8770]}}}}}}}}}}}}}}}, 0x69: {l: {0x6C: {l: {0x69: {l: {0x62: {l: {0x72: {l: {0x69: {l: {0x75: {l: {0x6D: {l: {0x3B: {c: [8652]}}}}}}}}}}}}}}}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [8496]}}}}}, 0x69: {l: {0x6D: {l: {0x3B: {c: [10867]}}}}}}}, 0x74: {l: {0x61: {l: {0x3B: {c: [919]}}}}}, 0x54: {l: {0x48: {l: {0x3B: {c: [208]}}, c: [208]}}}, 0x75: {l: {0x6D: {l: {0x6C: {l: {0x3B: {c: [203]}}, c: [203]}}}}}, 0x78: {l: {0x69: {l: {0x73: {l: {0x74: {l: {0x73: {l: {0x3B: {c: [8707]}}}}}}}}}, 0x70: {l: {0x6F: {l: {0x6E: {l: {0x65: {l: {0x6E: {l: {0x74: {l: {0x69: {l: {0x61: {l: {0x6C: {l: {0x45: {l: {0x3B: {c: [8519]}}}}}}}}}}}}}}}}}}}}}}}}}, | |
0x65: {l: {0x61: {l: {0x63: {l: {0x75: {l: {0x74: {l: {0x65: {l: {0x3B: {c: [233]}}, c: [233]}}}}}}}, 0x73: {l: {0x74: {l: {0x65: {l: {0x72: {l: {0x3B: {c: [10862]}}}}}}}}}}}, 0x63: {l: {0x61: {l: {0x72: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [283]}}}}}}}}}, 0x69: {l: {0x72: {l: {0x63: {l: {0x3B: {c: [234]}}, c: [234]}, 0x3B: {c: [8790]}}}}}, 0x6F: {l: {0x6C: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [8789]}}}}}}}}}, 0x79: {l: {0x3B: {c: [1101]}}}}}, 0x44: {l: {0x44: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [10871]}}}}}}}, 0x6F: {l: {0x74: {l: {0x3B: {c: [8785]}}}}}}}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [279]}}}}}}}, 0x65: {l: {0x3B: {c: [8519]}}}, 0x66: {l: {0x44: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [8786]}}}}}}}, 0x72: {l: {0x3B: {c: [120098]}}}}}, 0x67: {l: {0x3B: {c: [10906]}, 0x72: {l: {0x61: {l: {0x76: {l: {0x65: {l: {0x3B: {c: [232]}}, c: [232]}}}}}}}, 0x73: {l: {0x3B: {c: [10902]}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [10904]}}}}}}}}}}}, 0x6C: {l: {0x3B: {c: [10905]}, 0x69: {l: {0x6E: {l: {0x74: {l: {0x65: {l: {0x72: {l: {0x73: {l: {0x3B: {c: [9191]}}}}}}}}}}}}}, 0x6C: {l: {0x3B: {c: [8467]}}}, 0x73: {l: {0x3B: {c: [10901]}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [10903]}}}}}}}}}}}, 0x6D: {l: {0x61: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [275]}}}}}}}, 0x70: {l: {0x74: {l: {0x79: {l: {0x3B: {c: [8709]}, 0x73: {l: {0x65: {l: {0x74: {l: {0x3B: {c: [8709]}}}}}}}, 0x76: {l: {0x3B: {c: [8709]}}}}}}}}}, 0x73: {l: {0x70: {l: {0x31: {l: {0x33: {l: {0x3B: {c: [8196]}}}, 0x34: {l: {0x3B: {c: [8197]}}}}}, 0x3B: {c: [8195]}}}}}}}, 0x6E: {l: {0x67: {l: {0x3B: {c: [331]}}}, 0x73: {l: {0x70: {l: {0x3B: {c: [8194]}}}}}}}, 0x6F: {l: {0x67: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [281]}}}}}}}, 0x70: {l: {0x66: {l: {0x3B: {c: [120150]}}}}}}}, 0x70: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [8917]}, 0x73: {l: {0x6C: {l: {0x3B: {c: [10723]}}}}}}}}}, 0x6C: {l: {0x75: {l: {0x73: {l: {0x3B: {c: [10865]}}}}}}}, 0x73: {l: {0x69: {l: {0x3B: {c: [949]}, 0x6C: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [949]}}}}}}}, 0x76: {l: {0x3B: {c: [1013]}}}}}}}}}, 0x71: {l: {0x63: {l: {0x69: {l: {0x72: {l: {0x63: {l: {0x3B: {c: [8790]}}}}}}}, 0x6F: {l: {0x6C: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [8789]}}}}}}}}}}}, 0x73: {l: {0x69: {l: {0x6D: {l: {0x3B: {c: [8770]}}}}}, 0x6C: {l: {0x61: {l: {0x6E: {l: {0x74: {l: {0x67: {l: {0x74: {l: {0x72: {l: {0x3B: {c: [10902]}}}}}}}, 0x6C: {l: {0x65: {l: {0x73: {l: {0x73: {l: {0x3B: {c: [10901]}}}}}}}}}}}}}}}}}}}, 0x75: {l: {0x61: {l: {0x6C: {l: {0x73: {l: {0x3B: {c: [61]}}}}}}}, 0x65: {l: {0x73: {l: {0x74: {l: {0x3B: {c: [8799]}}}}}}}, 0x69: {l: {0x76: {l: {0x3B: {c: [8801]}, 0x44: {l: {0x44: {l: {0x3B: {c: [10872]}}}}}}}}}}}, 0x76: {l: {0x70: {l: {0x61: {l: {0x72: {l: {0x73: {l: {0x6C: {l: {0x3B: {c: [10725]}}}}}}}}}}}}}}}, 0x72: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x3B: {c: [10609]}}}}}}}, 0x44: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [8787]}}}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [8495]}}}}}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [8784]}}}}}}}, 0x69: {l: {0x6D: {l: {0x3B: {c: [8770]}}}}}}}, 0x74: {l: {0x61: {l: {0x3B: {c: [951]}}}, 0x68: {l: {0x3B: {c: [240]}}, c: [240]}}}, 0x75: {l: {0x6D: {l: {0x6C: {l: {0x3B: {c: [235]}}, c: [235]}}}, 0x72: {l: {0x6F: {l: {0x3B: {c: [8364]}}}}}}}, 0x78: {l: {0x63: {l: {0x6C: {l: {0x3B: {c: [33]}}}}}, 0x69: {l: {0x73: {l: {0x74: {l: {0x3B: {c: [8707]}}}}}}}, 0x70: {l: {0x65: {l: {0x63: {l: {0x74: {l: {0x61: {l: {0x74: {l: {0x69: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [8496]}}}}}}}}}}}}}}}}}, 0x6F: {l: {0x6E: {l: {0x65: {l: {0x6E: {l: {0x74: {l: {0x69: {l: {0x61: {l: {0x6C: {l: {0x65: {l: {0x3B: {c: [8519]}}}}}}}}}}}}}}}}}}}}}}}}}, | |
0x66: {l: {0x61: {l: {0x6C: {l: {0x6C: {l: {0x69: {l: {0x6E: {l: {0x67: {l: {0x64: {l: {0x6F: {l: {0x74: {l: {0x73: {l: {0x65: {l: {0x71: {l: {0x3B: {c: [8786]}}}}}}}}}}}}}}}}}}}}}}}}}, 0x63: {l: {0x79: {l: {0x3B: {c: [1092]}}}}}, 0x65: {l: {0x6D: {l: {0x61: {l: {0x6C: {l: {0x65: {l: {0x3B: {c: [9792]}}}}}}}}}}}, 0x66: {l: {0x69: {l: {0x6C: {l: {0x69: {l: {0x67: {l: {0x3B: {c: [64259]}}}}}}}}}, 0x6C: {l: {0x69: {l: {0x67: {l: {0x3B: {c: [64256]}}}}}, 0x6C: {l: {0x69: {l: {0x67: {l: {0x3B: {c: [64260]}}}}}}}}}, 0x72: {l: {0x3B: {c: [120099]}}}}}, 0x69: {l: {0x6C: {l: {0x69: {l: {0x67: {l: {0x3B: {c: [64257]}}}}}}}}}, 0x6A: {l: {0x6C: {l: {0x69: {l: {0x67: {l: {0x3B: {c: [102, 106]}}}}}}}}}, 0x6C: {l: {0x61: {l: {0x74: {l: {0x3B: {c: [9837]}}}}}, 0x6C: {l: {0x69: {l: {0x67: {l: {0x3B: {c: [64258]}}}}}}}, 0x74: {l: {0x6E: {l: {0x73: {l: {0x3B: {c: [9649]}}}}}}}}}, 0x6E: {l: {0x6F: {l: {0x66: {l: {0x3B: {c: [402]}}}}}}}, 0x6F: {l: {0x70: {l: {0x66: {l: {0x3B: {c: [120151]}}}}}, 0x72: {l: {0x61: {l: {0x6C: {l: {0x6C: {l: {0x3B: {c: [8704]}}}}}}}, 0x6B: {l: {0x3B: {c: [8916]}, 0x76: {l: {0x3B: {c: [10969]}}}}}}}}}, 0x70: {l: {0x61: {l: {0x72: {l: {0x74: {l: {0x69: {l: {0x6E: {l: {0x74: {l: {0x3B: {c: [10765]}}}}}}}}}}}}}}}, 0x72: {l: {0x61: {l: {0x63: {l: {0x31: {l: {0x32: {l: {0x3B: {c: [189]}}, c: [189]}, 0x33: {l: {0x3B: {c: [8531]}}}, 0x34: {l: {0x3B: {c: [188]}}, c: [188]}, 0x35: {l: {0x3B: {c: [8533]}}}, 0x36: {l: {0x3B: {c: [8537]}}}, 0x38: {l: {0x3B: {c: [8539]}}}}}, 0x32: {l: {0x33: {l: {0x3B: {c: [8532]}}}, 0x35: {l: {0x3B: {c: [8534]}}}}}, 0x33: {l: {0x34: {l: {0x3B: {c: [190]}}, c: [190]}, 0x35: {l: {0x3B: {c: [8535]}}}, 0x38: {l: {0x3B: {c: [8540]}}}}}, 0x34: {l: {0x35: {l: {0x3B: {c: [8536]}}}}}, 0x35: {l: {0x36: {l: {0x3B: {c: [8538]}}}, 0x38: {l: {0x3B: {c: [8541]}}}}}, 0x37: {l: {0x38: {l: {0x3B: {c: [8542]}}}}}}}, 0x73: {l: {0x6C: {l: {0x3B: {c: [8260]}}}}}}}, 0x6F: {l: {0x77: {l: {0x6E: {l: {0x3B: {c: [8994]}}}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [119995]}}}}}}}}}, | |
0x46: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1060]}}}}}, 0x66: {l: {0x72: {l: {0x3B: {c: [120073]}}}}}, 0x69: {l: {0x6C: {l: {0x6C: {l: {0x65: {l: {0x64: {l: {0x53: {l: {0x6D: {l: {0x61: {l: {0x6C: {l: {0x6C: {l: {0x53: {l: {0x71: {l: {0x75: {l: {0x61: {l: {0x72: {l: {0x65: {l: {0x3B: {c: [9724]}}}}}}}}}}}}}}}}}}}}}}}, 0x56: {l: {0x65: {l: {0x72: {l: {0x79: {l: {0x53: {l: {0x6D: {l: {0x61: {l: {0x6C: {l: {0x6C: {l: {0x53: {l: {0x71: {l: {0x75: {l: {0x61: {l: {0x72: {l: {0x65: {l: {0x3B: {c: [9642]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x6F: {l: {0x70: {l: {0x66: {l: {0x3B: {c: [120125]}}}}}, 0x72: {l: {0x41: {l: {0x6C: {l: {0x6C: {l: {0x3B: {c: [8704]}}}}}}}}}, 0x75: {l: {0x72: {l: {0x69: {l: {0x65: {l: {0x72: {l: {0x74: {l: {0x72: {l: {0x66: {l: {0x3B: {c: [8497]}}}}}}}}}}}}}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [8497]}}}}}}}}}, | |
0x67: {l: {0x61: {l: {0x63: {l: {0x75: {l: {0x74: {l: {0x65: {l: {0x3B: {c: [501]}}}}}}}}}, 0x6D: {l: {0x6D: {l: {0x61: {l: {0x3B: {c: [947]}, 0x64: {l: {0x3B: {c: [989]}}}}}}}}}, 0x70: {l: {0x3B: {c: [10886]}}}}}, 0x62: {l: {0x72: {l: {0x65: {l: {0x76: {l: {0x65: {l: {0x3B: {c: [287]}}}}}}}}}}}, 0x63: {l: {0x69: {l: {0x72: {l: {0x63: {l: {0x3B: {c: [285]}}}}}}}, 0x79: {l: {0x3B: {c: [1075]}}}}}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [289]}}}}}}}, 0x65: {l: {0x3B: {c: [8805]}, 0x6C: {l: {0x3B: {c: [8923]}}}, 0x71: {l: {0x3B: {c: [8805]}, 0x71: {l: {0x3B: {c: [8807]}}}, 0x73: {l: {0x6C: {l: {0x61: {l: {0x6E: {l: {0x74: {l: {0x3B: {c: [10878]}}}}}}}}}}}}}, 0x73: {l: {0x63: {l: {0x63: {l: {0x3B: {c: [10921]}}}}}, 0x3B: {c: [10878]}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [10880]}, 0x6F: {l: {0x3B: {c: [10882]}, 0x6C: {l: {0x3B: {c: [10884]}}}}}}}}}}}, 0x6C: {l: {0x3B: {c: [8923, 65024]}, 0x65: {l: {0x73: {l: {0x3B: {c: [10900]}}}}}}}}}}}, 0x45: {l: {0x3B: {c: [8807]}, 0x6C: {l: {0x3B: {c: [10892]}}}}}, 0x66: {l: {0x72: {l: {0x3B: {c: [120100]}}}}}, 0x67: {l: {0x3B: {c: [8811]}, 0x67: {l: {0x3B: {c: [8921]}}}}}, 0x69: {l: {0x6D: {l: {0x65: {l: {0x6C: {l: {0x3B: {c: [8503]}}}}}}}}}, 0x6A: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1107]}}}}}}}, 0x6C: {l: {0x61: {l: {0x3B: {c: [10917]}}}, 0x3B: {c: [8823]}, 0x45: {l: {0x3B: {c: [10898]}}}, 0x6A: {l: {0x3B: {c: [10916]}}}}}, 0x6E: {l: {0x61: {l: {0x70: {l: {0x3B: {c: [10890]}, 0x70: {l: {0x72: {l: {0x6F: {l: {0x78: {l: {0x3B: {c: [10890]}}}}}}}}}}}}}, 0x65: {l: {0x3B: {c: [10888]}, 0x71: {l: {0x3B: {c: [10888]}, 0x71: {l: {0x3B: {c: [8809]}}}}}}}, 0x45: {l: {0x3B: {c: [8809]}}}, 0x73: {l: {0x69: {l: {0x6D: {l: {0x3B: {c: [8935]}}}}}}}}}, 0x6F: {l: {0x70: {l: {0x66: {l: {0x3B: {c: [120152]}}}}}}}, 0x72: {l: {0x61: {l: {0x76: {l: {0x65: {l: {0x3B: {c: [96]}}}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [8458]}}}}}, 0x69: {l: {0x6D: {l: {0x3B: {c: [8819]}, 0x65: {l: {0x3B: {c: [10894]}}}, 0x6C: {l: {0x3B: {c: [10896]}}}}}}}}}, 0x74: {l: {0x63: {l: {0x63: {l: {0x3B: {c: [10919]}}}, 0x69: {l: {0x72: {l: {0x3B: {c: [10874]}}}}}}}, 0x3B: {c: [62]}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [8919]}}}}}}}, 0x6C: {l: {0x50: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [10645]}}}}}}}}}, 0x71: {l: {0x75: {l: {0x65: {l: {0x73: {l: {0x74: {l: {0x3B: {c: [10876]}}}}}}}}}}}, 0x72: {l: {0x61: {l: {0x70: {l: {0x70: {l: {0x72: {l: {0x6F: {l: {0x78: {l: {0x3B: {c: [10886]}}}}}}}}}}}, 0x72: {l: {0x72: {l: {0x3B: {c: [10616]}}}}}}}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [8919]}}}}}}}, 0x65: {l: {0x71: {l: {0x6C: {l: {0x65: {l: {0x73: {l: {0x73: {l: {0x3B: {c: [8923]}}}}}}}}}, 0x71: {l: {0x6C: {l: {0x65: {l: {0x73: {l: {0x73: {l: {0x3B: {c: [10892]}}}}}}}}}}}}}}}, 0x6C: {l: {0x65: {l: {0x73: {l: {0x73: {l: {0x3B: {c: [8823]}}}}}}}}}, 0x73: {l: {0x69: {l: {0x6D: {l: {0x3B: {c: [8819]}}}}}}}}}}, c: [62]}, 0x76: {l: {0x65: {l: {0x72: {l: {0x74: {l: {0x6E: {l: {0x65: {l: {0x71: {l: {0x71: {l: {0x3B: {c: [8809, 65024]}}}}}}}}}}}}}}}, 0x6E: {l: {0x45: {l: {0x3B: {c: [8809, 65024]}}}}}}}}}, | |
0x47: {l: {0x61: {l: {0x6D: {l: {0x6D: {l: {0x61: {l: {0x3B: {c: [915]}, 0x64: {l: {0x3B: {c: [988]}}}}}}}}}}}, 0x62: {l: {0x72: {l: {0x65: {l: {0x76: {l: {0x65: {l: {0x3B: {c: [286]}}}}}}}}}}}, 0x63: {l: {0x65: {l: {0x64: {l: {0x69: {l: {0x6C: {l: {0x3B: {c: [290]}}}}}}}}}, 0x69: {l: {0x72: {l: {0x63: {l: {0x3B: {c: [284]}}}}}}}, 0x79: {l: {0x3B: {c: [1043]}}}}}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [288]}}}}}}}, 0x66: {l: {0x72: {l: {0x3B: {c: [120074]}}}}}, 0x67: {l: {0x3B: {c: [8921]}}}, 0x4A: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1027]}}}}}}}, 0x6F: {l: {0x70: {l: {0x66: {l: {0x3B: {c: [120126]}}}}}}}, 0x72: {l: {0x65: {l: {0x61: {l: {0x74: {l: {0x65: {l: {0x72: {l: {0x45: {l: {0x71: {l: {0x75: {l: {0x61: {l: {0x6C: {l: {0x3B: {c: [8805]}, 0x4C: {l: {0x65: {l: {0x73: {l: {0x73: {l: {0x3B: {c: [8923]}}}}}}}}}}}}}}}}}}}, 0x46: {l: {0x75: {l: {0x6C: {l: {0x6C: {l: {0x45: {l: {0x71: {l: {0x75: {l: {0x61: {l: {0x6C: {l: {0x3B: {c: [8807]}}}}}}}}}}}}}}}}}}}, 0x47: {l: {0x72: {l: {0x65: {l: {0x61: {l: {0x74: {l: {0x65: {l: {0x72: {l: {0x3B: {c: [10914]}}}}}}}}}}}}}}}, 0x4C: {l: {0x65: {l: {0x73: {l: {0x73: {l: {0x3B: {c: [8823]}}}}}}}}}, 0x53: {l: {0x6C: {l: {0x61: {l: {0x6E: {l: {0x74: {l: {0x45: {l: {0x71: {l: {0x75: {l: {0x61: {l: {0x6C: {l: {0x3B: {c: [10878]}}}}}}}}}}}}}}}}}}}}}, 0x54: {l: {0x69: {l: {0x6C: {l: {0x64: {l: {0x65: {l: {0x3B: {c: [8819]}}}}}}}}}}}}}}}}}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [119970]}}}}}}}, 0x54: {l: {0x3B: {c: [62]}}, c: [62]}, 0x74: {l: {0x3B: {c: [8811]}}}}}, | |
0x48: {l: {0x61: {l: {0x63: {l: {0x65: {l: {0x6B: {l: {0x3B: {c: [711]}}}}}}}, 0x74: {l: {0x3B: {c: [94]}}}}}, 0x41: {l: {0x52: {l: {0x44: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1066]}}}}}}}}}}}, 0x63: {l: {0x69: {l: {0x72: {l: {0x63: {l: {0x3B: {c: [292]}}}}}}}}}, 0x66: {l: {0x72: {l: {0x3B: {c: [8460]}}}}}, 0x69: {l: {0x6C: {l: {0x62: {l: {0x65: {l: {0x72: {l: {0x74: {l: {0x53: {l: {0x70: {l: {0x61: {l: {0x63: {l: {0x65: {l: {0x3B: {c: [8459]}}}}}}}}}}}}}}}}}}}}}}}, 0x6F: {l: {0x70: {l: {0x66: {l: {0x3B: {c: [8461]}}}}}, 0x72: {l: {0x69: {l: {0x7A: {l: {0x6F: {l: {0x6E: {l: {0x74: {l: {0x61: {l: {0x6C: {l: {0x4C: {l: {0x69: {l: {0x6E: {l: {0x65: {l: {0x3B: {c: [9472]}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [8459]}}}}}, 0x74: {l: {0x72: {l: {0x6F: {l: {0x6B: {l: {0x3B: {c: [294]}}}}}}}}}}}, 0x75: {l: {0x6D: {l: {0x70: {l: {0x44: {l: {0x6F: {l: {0x77: {l: {0x6E: {l: {0x48: {l: {0x75: {l: {0x6D: {l: {0x70: {l: {0x3B: {c: [8782]}}}}}}}}}}}}}}}}}, 0x45: {l: {0x71: {l: {0x75: {l: {0x61: {l: {0x6C: {l: {0x3B: {c: [8783]}}}}}}}}}}}}}}}}}}}, | |
0x68: {l: {0x61: {l: {0x69: {l: {0x72: {l: {0x73: {l: {0x70: {l: {0x3B: {c: [8202]}}}}}}}}}, 0x6C: {l: {0x66: {l: {0x3B: {c: [189]}}}}}, 0x6D: {l: {0x69: {l: {0x6C: {l: {0x74: {l: {0x3B: {c: [8459]}}}}}}}}}, 0x72: {l: {0x64: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1098]}}}}}}}, 0x72: {l: {0x63: {l: {0x69: {l: {0x72: {l: {0x3B: {c: [10568]}}}}}}}, 0x3B: {c: [8596]}, 0x77: {l: {0x3B: {c: [8621]}}}}}}}}}, 0x41: {l: {0x72: {l: {0x72: {l: {0x3B: {c: [8660]}}}}}}}, 0x62: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [8463]}}}}}}}, 0x63: {l: {0x69: {l: {0x72: {l: {0x63: {l: {0x3B: {c: [293]}}}}}}}}}, 0x65: {l: {0x61: {l: {0x72: {l: {0x74: {l: {0x73: {l: {0x3B: {c: [9829]}, 0x75: {l: {0x69: {l: {0x74: {l: {0x3B: {c: [9829]}}}}}}}}}}}}}}}, 0x6C: {l: {0x6C: {l: {0x69: {l: {0x70: {l: {0x3B: {c: [8230]}}}}}}}}}, 0x72: {l: {0x63: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [8889]}}}}}}}}}}}, 0x66: {l: {0x72: {l: {0x3B: {c: [120101]}}}}}, 0x6B: {l: {0x73: {l: {0x65: {l: {0x61: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [10533]}}}}}}}}}}}, 0x77: {l: {0x61: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [10534]}}}}}}}}}}}}}}}, 0x6F: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x3B: {c: [8703]}}}}}}}, 0x6D: {l: {0x74: {l: {0x68: {l: {0x74: {l: {0x3B: {c: [8763]}}}}}}}}}, 0x6F: {l: {0x6B: {l: {0x6C: {l: {0x65: {l: {0x66: {l: {0x74: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8617]}}}}}}}}}}}}}}}}}}}, 0x72: {l: {0x69: {l: {0x67: {l: {0x68: {l: {0x74: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8618]}}}}}}}}}}}}}}}}}}}}}}}}}, 0x70: {l: {0x66: {l: {0x3B: {c: [120153]}}}}}, 0x72: {l: {0x62: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [8213]}}}}}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [119997]}}}}}, 0x6C: {l: {0x61: {l: {0x73: {l: {0x68: {l: {0x3B: {c: [8463]}}}}}}}}}, 0x74: {l: {0x72: {l: {0x6F: {l: {0x6B: {l: {0x3B: {c: [295]}}}}}}}}}}}, 0x79: {l: {0x62: {l: {0x75: {l: {0x6C: {l: {0x6C: {l: {0x3B: {c: [8259]}}}}}}}}}, 0x70: {l: {0x68: {l: {0x65: {l: {0x6E: {l: {0x3B: {c: [8208]}}}}}}}}}}}}}, | |
0x49: {l: {0x61: {l: {0x63: {l: {0x75: {l: {0x74: {l: {0x65: {l: {0x3B: {c: [205]}}, c: [205]}}}}}}}}}, 0x63: {l: {0x69: {l: {0x72: {l: {0x63: {l: {0x3B: {c: [206]}}, c: [206]}}}}}, 0x79: {l: {0x3B: {c: [1048]}}}}}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [304]}}}}}}}, 0x45: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1045]}}}}}}}, 0x66: {l: {0x72: {l: {0x3B: {c: [8465]}}}}}, 0x67: {l: {0x72: {l: {0x61: {l: {0x76: {l: {0x65: {l: {0x3B: {c: [204]}}, c: [204]}}}}}}}}}, 0x4A: {l: {0x6C: {l: {0x69: {l: {0x67: {l: {0x3B: {c: [306]}}}}}}}}}, 0x6D: {l: {0x61: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [298]}}}}}, 0x67: {l: {0x69: {l: {0x6E: {l: {0x61: {l: {0x72: {l: {0x79: {l: {0x49: {l: {0x3B: {c: [8520]}}}}}}}}}}}}}}}}}, 0x3B: {c: [8465]}, 0x70: {l: {0x6C: {l: {0x69: {l: {0x65: {l: {0x73: {l: {0x3B: {c: [8658]}}}}}}}}}}}}}, 0x6E: {l: {0x74: {l: {0x3B: {c: [8748]}, 0x65: {l: {0x67: {l: {0x72: {l: {0x61: {l: {0x6C: {l: {0x3B: {c: [8747]}}}}}}}}}, 0x72: {l: {0x73: {l: {0x65: {l: {0x63: {l: {0x74: {l: {0x69: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [8898]}}}}}}}}}}}}}}}}}}}}}, 0x76: {l: {0x69: {l: {0x73: {l: {0x69: {l: {0x62: {l: {0x6C: {l: {0x65: {l: {0x43: {l: {0x6F: {l: {0x6D: {l: {0x6D: {l: {0x61: {l: {0x3B: {c: [8291]}}}}}}}}}}}, 0x54: {l: {0x69: {l: {0x6D: {l: {0x65: {l: {0x73: {l: {0x3B: {c: [8290]}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x4F: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1025]}}}}}}}, 0x6F: {l: {0x67: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [302]}}}}}}}, 0x70: {l: {0x66: {l: {0x3B: {c: [120128]}}}}}, 0x74: {l: {0x61: {l: {0x3B: {c: [921]}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [8464]}}}}}}}, 0x74: {l: {0x69: {l: {0x6C: {l: {0x64: {l: {0x65: {l: {0x3B: {c: [296]}}}}}}}}}}}, 0x75: {l: {0x6B: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1030]}}}}}}}, 0x6D: {l: {0x6C: {l: {0x3B: {c: [207]}}, c: [207]}}}}}}}, | |
0x69: {l: {0x61: {l: {0x63: {l: {0x75: {l: {0x74: {l: {0x65: {l: {0x3B: {c: [237]}}, c: [237]}}}}}}}}}, 0x63: {l: {0x3B: {c: [8291]}, 0x69: {l: {0x72: {l: {0x63: {l: {0x3B: {c: [238]}}, c: [238]}}}}}, 0x79: {l: {0x3B: {c: [1080]}}}}}, 0x65: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1077]}}}}}, 0x78: {l: {0x63: {l: {0x6C: {l: {0x3B: {c: [161]}}, c: [161]}}}}}}}, 0x66: {l: {0x66: {l: {0x3B: {c: [8660]}}}, 0x72: {l: {0x3B: {c: [120102]}}}}}, 0x67: {l: {0x72: {l: {0x61: {l: {0x76: {l: {0x65: {l: {0x3B: {c: [236]}}, c: [236]}}}}}}}}}, 0x69: {l: {0x3B: {c: [8520]}, 0x69: {l: {0x69: {l: {0x6E: {l: {0x74: {l: {0x3B: {c: [10764]}}}}}}}, 0x6E: {l: {0x74: {l: {0x3B: {c: [8749]}}}}}}}, 0x6E: {l: {0x66: {l: {0x69: {l: {0x6E: {l: {0x3B: {c: [10716]}}}}}}}}}, 0x6F: {l: {0x74: {l: {0x61: {l: {0x3B: {c: [8489]}}}}}}}}}, 0x6A: {l: {0x6C: {l: {0x69: {l: {0x67: {l: {0x3B: {c: [307]}}}}}}}}}, 0x6D: {l: {0x61: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [299]}}}}}, 0x67: {l: {0x65: {l: {0x3B: {c: [8465]}}}, 0x6C: {l: {0x69: {l: {0x6E: {l: {0x65: {l: {0x3B: {c: [8464]}}}}}}}}}, 0x70: {l: {0x61: {l: {0x72: {l: {0x74: {l: {0x3B: {c: [8465]}}}}}}}}}}}, 0x74: {l: {0x68: {l: {0x3B: {c: [305]}}}}}}}, 0x6F: {l: {0x66: {l: {0x3B: {c: [8887]}}}}}, 0x70: {l: {0x65: {l: {0x64: {l: {0x3B: {c: [437]}}}}}}}}}, 0x6E: {l: {0x63: {l: {0x61: {l: {0x72: {l: {0x65: {l: {0x3B: {c: [8453]}}}}}}}}}, 0x3B: {c: [8712]}, 0x66: {l: {0x69: {l: {0x6E: {l: {0x3B: {c: [8734]}, 0x74: {l: {0x69: {l: {0x65: {l: {0x3B: {c: [10717]}}}}}}}}}}}}}, 0x6F: {l: {0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [305]}}}}}}}}}, 0x74: {l: {0x63: {l: {0x61: {l: {0x6C: {l: {0x3B: {c: [8890]}}}}}}}, 0x3B: {c: [8747]}, 0x65: {l: {0x67: {l: {0x65: {l: {0x72: {l: {0x73: {l: {0x3B: {c: [8484]}}}}}}}}}, 0x72: {l: {0x63: {l: {0x61: {l: {0x6C: {l: {0x3B: {c: [8890]}}}}}}}}}}}, 0x6C: {l: {0x61: {l: {0x72: {l: {0x68: {l: {0x6B: {l: {0x3B: {c: [10775]}}}}}}}}}}}, 0x70: {l: {0x72: {l: {0x6F: {l: {0x64: {l: {0x3B: {c: [10812]}}}}}}}}}}}}}, 0x6F: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1105]}}}}}, 0x67: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [303]}}}}}}}, 0x70: {l: {0x66: {l: {0x3B: {c: [120154]}}}}}, 0x74: {l: {0x61: {l: {0x3B: {c: [953]}}}}}}}, 0x70: {l: {0x72: {l: {0x6F: {l: {0x64: {l: {0x3B: {c: [10812]}}}}}}}}}, 0x71: {l: {0x75: {l: {0x65: {l: {0x73: {l: {0x74: {l: {0x3B: {c: [191]}}, c: [191]}}}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [119998]}}}}}, 0x69: {l: {0x6E: {l: {0x3B: {c: [8712]}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [8949]}}}}}}}, 0x45: {l: {0x3B: {c: [8953]}}}, 0x73: {l: {0x3B: {c: [8948]}, 0x76: {l: {0x3B: {c: [8947]}}}}}, 0x76: {l: {0x3B: {c: [8712]}}}}}}}}}, 0x74: {l: {0x3B: {c: [8290]}, 0x69: {l: {0x6C: {l: {0x64: {l: {0x65: {l: {0x3B: {c: [297]}}}}}}}}}}}, 0x75: {l: {0x6B: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1110]}}}}}}}, 0x6D: {l: {0x6C: {l: {0x3B: {c: [239]}}, c: [239]}}}}}}}, | |
0x4A: {l: {0x63: {l: {0x69: {l: {0x72: {l: {0x63: {l: {0x3B: {c: [308]}}}}}}}, 0x79: {l: {0x3B: {c: [1049]}}}}}, 0x66: {l: {0x72: {l: {0x3B: {c: [120077]}}}}}, 0x6F: {l: {0x70: {l: {0x66: {l: {0x3B: {c: [120129]}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [119973]}}}}}, 0x65: {l: {0x72: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1032]}}}}}}}}}}}, 0x75: {l: {0x6B: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1028]}}}}}}}}}}}, | |
0x6A: {l: {0x63: {l: {0x69: {l: {0x72: {l: {0x63: {l: {0x3B: {c: [309]}}}}}}}, 0x79: {l: {0x3B: {c: [1081]}}}}}, 0x66: {l: {0x72: {l: {0x3B: {c: [120103]}}}}}, 0x6D: {l: {0x61: {l: {0x74: {l: {0x68: {l: {0x3B: {c: [567]}}}}}}}}}, 0x6F: {l: {0x70: {l: {0x66: {l: {0x3B: {c: [120155]}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [119999]}}}}}, 0x65: {l: {0x72: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1112]}}}}}}}}}}}, 0x75: {l: {0x6B: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1108]}}}}}}}}}}}, | |
0x4B: {l: {0x61: {l: {0x70: {l: {0x70: {l: {0x61: {l: {0x3B: {c: [922]}}}}}}}}}, 0x63: {l: {0x65: {l: {0x64: {l: {0x69: {l: {0x6C: {l: {0x3B: {c: [310]}}}}}}}}}, 0x79: {l: {0x3B: {c: [1050]}}}}}, 0x66: {l: {0x72: {l: {0x3B: {c: [120078]}}}}}, 0x48: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1061]}}}}}}}, 0x4A: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1036]}}}}}}}, 0x6F: {l: {0x70: {l: {0x66: {l: {0x3B: {c: [120130]}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [119974]}}}}}}}}}, | |
0x6B: {l: {0x61: {l: {0x70: {l: {0x70: {l: {0x61: {l: {0x3B: {c: [954]}, 0x76: {l: {0x3B: {c: [1008]}}}}}}}}}}}, 0x63: {l: {0x65: {l: {0x64: {l: {0x69: {l: {0x6C: {l: {0x3B: {c: [311]}}}}}}}}}, 0x79: {l: {0x3B: {c: [1082]}}}}}, 0x66: {l: {0x72: {l: {0x3B: {c: [120104]}}}}}, 0x67: {l: {0x72: {l: {0x65: {l: {0x65: {l: {0x6E: {l: {0x3B: {c: [312]}}}}}}}}}}}, 0x68: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1093]}}}}}}}, 0x6A: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1116]}}}}}}}, 0x6F: {l: {0x70: {l: {0x66: {l: {0x3B: {c: [120156]}}}}}}}, 0x73: {l: {0x63: {l: {0x72: {l: {0x3B: {c: [120000]}}}}}}}}}, | |
0x6C: {l: {0x41: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x3B: {c: [8666]}}}}}}}, 0x72: {l: {0x72: {l: {0x3B: {c: [8656]}}}}}, 0x74: {l: {0x61: {l: {0x69: {l: {0x6C: {l: {0x3B: {c: [10523]}}}}}}}}}}}, 0x61: {l: {0x63: {l: {0x75: {l: {0x74: {l: {0x65: {l: {0x3B: {c: [314]}}}}}}}}}, 0x65: {l: {0x6D: {l: {0x70: {l: {0x74: {l: {0x79: {l: {0x76: {l: {0x3B: {c: [10676]}}}}}}}}}}}}}, 0x67: {l: {0x72: {l: {0x61: {l: {0x6E: {l: {0x3B: {c: [8466]}}}}}}}}}, 0x6D: {l: {0x62: {l: {0x64: {l: {0x61: {l: {0x3B: {c: [955]}}}}}}}}}, 0x6E: {l: {0x67: {l: {0x3B: {c: [10216]}, 0x64: {l: {0x3B: {c: [10641]}}}, 0x6C: {l: {0x65: {l: {0x3B: {c: [10216]}}}}}}}}}, 0x70: {l: {0x3B: {c: [10885]}}}, 0x71: {l: {0x75: {l: {0x6F: {l: {0x3B: {c: [171]}}, c: [171]}}}}}, 0x72: {l: {0x72: {l: {0x62: {l: {0x3B: {c: [8676]}, 0x66: {l: {0x73: {l: {0x3B: {c: [10527]}}}}}}}, 0x3B: {c: [8592]}, 0x66: {l: {0x73: {l: {0x3B: {c: [10525]}}}}}, 0x68: {l: {0x6B: {l: {0x3B: {c: [8617]}}}}}, 0x6C: {l: {0x70: {l: {0x3B: {c: [8619]}}}}}, 0x70: {l: {0x6C: {l: {0x3B: {c: [10553]}}}}}, 0x73: {l: {0x69: {l: {0x6D: {l: {0x3B: {c: [10611]}}}}}}}, 0x74: {l: {0x6C: {l: {0x3B: {c: [8610]}}}}}}}}}, 0x74: {l: {0x61: {l: {0x69: {l: {0x6C: {l: {0x3B: {c: [10521]}}}}}}}, 0x3B: {c: [10923]}, 0x65: {l: {0x3B: {c: [10925]}, 0x73: {l: {0x3B: {c: [10925, 65024]}}}}}}}}}, 0x62: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x3B: {c: [10508]}}}}}}}, 0x62: {l: {0x72: {l: {0x6B: {l: {0x3B: {c: [10098]}}}}}}}, 0x72: {l: {0x61: {l: {0x63: {l: {0x65: {l: {0x3B: {c: [123]}}}, 0x6B: {l: {0x3B: {c: [91]}}}}}}}, 0x6B: {l: {0x65: {l: {0x3B: {c: [10635]}}}, 0x73: {l: {0x6C: {l: {0x64: {l: {0x3B: {c: [10639]}}}, 0x75: {l: {0x3B: {c: [10637]}}}}}}}}}}}}}, 0x42: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x3B: {c: [10510]}}}}}}}}}, 0x63: {l: {0x61: {l: {0x72: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [318]}}}}}}}}}, 0x65: {l: {0x64: {l: {0x69: {l: {0x6C: {l: {0x3B: {c: [316]}}}}}}}, 0x69: {l: {0x6C: {l: {0x3B: {c: [8968]}}}}}}}, 0x75: {l: {0x62: {l: {0x3B: {c: [123]}}}}}, 0x79: {l: {0x3B: {c: [1083]}}}}}, 0x64: {l: {0x63: {l: {0x61: {l: {0x3B: {c: [10550]}}}}}, 0x71: {l: {0x75: {l: {0x6F: {l: {0x3B: {c: [8220]}, 0x72: {l: {0x3B: {c: [8222]}}}}}}}}}, 0x72: {l: {0x64: {l: {0x68: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [10599]}}}}}}}}}, 0x75: {l: {0x73: {l: {0x68: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [10571]}}}}}}}}}}}}}, 0x73: {l: {0x68: {l: {0x3B: {c: [8626]}}}}}}}, 0x65: {l: {0x3B: {c: [8804]}, 0x66: {l: {0x74: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8592]}, 0x74: {l: {0x61: {l: {0x69: {l: {0x6C: {l: {0x3B: {c: [8610]}}}}}}}}}}}}}}}}}}}, 0x68: {l: {0x61: {l: {0x72: {l: {0x70: {l: {0x6F: {l: {0x6F: {l: {0x6E: {l: {0x64: {l: {0x6F: {l: {0x77: {l: {0x6E: {l: {0x3B: {c: [8637]}}}}}}}}}, 0x75: {l: {0x70: {l: {0x3B: {c: [8636]}}}}}}}}}}}}}}}}}}}, 0x6C: {l: {0x65: {l: {0x66: {l: {0x74: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x73: {l: {0x3B: {c: [8647]}}}}}}}}}}}}}}}}}}}}}, 0x72: {l: {0x69: {l: {0x67: {l: {0x68: {l: {0x74: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8596]}, 0x73: {l: {0x3B: {c: [8646]}}}}}}}}}}}}}, 0x68: {l: {0x61: {l: {0x72: {l: {0x70: {l: {0x6F: {l: {0x6F: {l: {0x6E: {l: {0x73: {l: {0x3B: {c: [8651]}}}}}}}}}}}}}}}}}, 0x73: {l: {0x71: {l: {0x75: {l: {0x69: {l: {0x67: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8621]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x74: {l: {0x68: {l: {0x72: {l: {0x65: {l: {0x65: {l: {0x74: {l: {0x69: {l: {0x6D: {l: {0x65: {l: {0x73: {l: {0x3B: {c: [8907]}}}}}}}}}}}}}}}}}}}}}}}}}, 0x67: {l: {0x3B: {c: [8922]}}}, 0x71: {l: {0x3B: {c: [8804]}, 0x71: {l: {0x3B: {c: [8806]}}}, 0x73: {l: {0x6C: {l: {0x61: {l: {0x6E: {l: {0x74: {l: {0x3B: {c: [10877]}}}}}}}}}}}}}, 0x73: {l: {0x63: {l: {0x63: {l: {0x3B: {c: [10920]}}}}}, 0x3B: {c: [10877]}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [10879]}, 0x6F: {l: {0x3B: {c: [10881]}, 0x72: {l: {0x3B: {c: [10883]}}}}}}}}}}}, 0x67: {l: {0x3B: {c: [8922, 65024]}, 0x65: {l: {0x73: {l: {0x3B: {c: [10899]}}}}}}}, 0x73: {l: {0x61: {l: {0x70: {l: {0x70: {l: {0x72: {l: {0x6F: {l: {0x78: {l: {0x3B: {c: [10885]}}}}}}}}}}}}}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [8918]}}}}}}}, 0x65: {l: {0x71: {l: {0x67: {l: {0x74: {l: {0x72: {l: {0x3B: {c: [8922]}}}}}}}, 0x71: {l: {0x67: {l: {0x74: {l: {0x72: {l: {0x3B: {c: [10891]}}}}}}}}}}}}}, 0x67: {l: {0x74: {l: {0x72: {l: {0x3B: {c: [8822]}}}}}}}, 0x73: {l: {0x69: {l: {0x6D: {l: {0x3B: {c: [8818]}}}}}}}}}}}}}, 0x45: {l: {0x3B: {c: [8806]}, 0x67: {l: {0x3B: {c: [10891]}}}}}, 0x66: {l: {0x69: {l: {0x73: {l: {0x68: {l: {0x74: {l: {0x3B: {c: [10620]}}}}}}}}}, 0x6C: {l: {0x6F: {l: {0x6F: {l: {0x72: {l: {0x3B: {c: [8970]}}}}}}}}}, 0x72: {l: {0x3B: {c: [120105]}}}}}, 0x67: {l: {0x3B: {c: [8822]}, 0x45: {l: {0x3B: {c: [10897]}}}}}, 0x48: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [10594]}}}}}}}, 0x68: {l: {0x61: {l: {0x72: {l: {0x64: {l: {0x3B: {c: [8637]}}}, 0x75: {l: {0x3B: {c: [8636]}, 0x6C: {l: {0x3B: {c: [10602]}}}}}}}}}, 0x62: {l: {0x6C: {l: {0x6B: {l: {0x3B: {c: [9604]}}}}}}}}}, 0x6A: {l: {0x63: {l: {0x79: {l: {0x3B: {c: [1113]}}}}}}}, 0x6C: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x3B: {c: [8647]}}}}}}}, 0x3B: {c: [8810]}, 0x63: {l: {0x6F: {l: {0x72: {l: {0x6E: {l: {0x65: {l: {0x72: {l: {0x3B: {c: [8990]}}}}}}}}}}}}}, 0x68: {l: {0x61: {l: {0x72: {l: {0x64: {l: {0x3B: {c: [10603]}}}}}}}}}, 0x74: {l: {0x72: {l: {0x69: {l: {0x3B: {c: [9722]}}}}}}}}}, 0x6D: {l: {0x69: {l: {0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [320]}}}}}}}}}, 0x6F: {l: {0x75: {l: {0x73: {l: {0x74: {l: {0x61: {l: {0x63: {l: {0x68: {l: {0x65: {l: {0x3B: {c: [9136]}}}}}}}}}, 0x3B: {c: [9136]}}}}}}}}}}}, 0x6E: {l: {0x61: {l: {0x70: {l: {0x3B: {c: [10889]}, 0x70: {l: {0x72: {l: {0x6F: {l: {0x78: {l: {0x3B: {c: [10889]}}}}}}}}}}}}}, 0x65: {l: {0x3B: {c: [10887]}, 0x71: {l: {0x3B: {c: [10887]}, 0x71: {l: {0x3B: {c: [8808]}}}}}}}, 0x45: {l: {0x3B: {c: [8808]}}}, 0x73: {l: {0x69: {l: {0x6D: {l: {0x3B: {c: [8934]}}}}}}}}}, 0x6F: {l: {0x61: {l: {0x6E: {l: {0x67: {l: {0x3B: {c: [10220]}}}}}, 0x72: {l: {0x72: {l: {0x3B: {c: [8701]}}}}}}}, 0x62: {l: {0x72: {l: {0x6B: {l: {0x3B: {c: [10214]}}}}}}}, 0x6E: {l: {0x67: {l: {0x6C: {l: {0x65: {l: {0x66: {l: {0x74: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [10229]}}}}}}}}}}}, 0x72: {l: {0x69: {l: {0x67: {l: {0x68: {l: {0x74: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [10231]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x6D: {l: {0x61: {l: {0x70: {l: {0x73: {l: {0x74: {l: {0x6F: {l: {0x3B: {c: [10236]}}}}}}}}}}}}}, 0x72: {l: {0x69: {l: {0x67: {l: {0x68: {l: {0x74: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [10230]}}}}}}}}}}}}}}}}}}}}}}}}}, 0x6F: {l: {0x70: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x6C: {l: {0x65: {l: {0x66: {l: {0x74: {l: {0x3B: {c: [8619]}}}}}}}}}, 0x72: {l: {0x69: {l: {0x67: {l: {0x68: {l: {0x74: {l: {0x3B: {c: [8620]}}}}}}}}}}}}}}}}}}}}}}}}}, 0x70: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [10629]}}}}}, 0x66: {l: {0x3B: {c: [120157]}}}, 0x6C: {l: {0x75: {l: {0x73: {l: {0x3B: {c: [10797]}}}}}}}}}, 0x74: {l: {0x69: {l: {0x6D: {l: {0x65: {l: {0x73: {l: {0x3B: {c: [10804]}}}}}}}}}}}, 0x77: {l: {0x61: {l: {0x73: {l: {0x74: {l: {0x3B: {c: [8727]}}}}}}}, 0x62: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [95]}}}}}}}}}, 0x7A: {l: {0x3B: {c: [9674]}, 0x65: {l: {0x6E: {l: {0x67: {l: {0x65: {l: {0x3B: {c: [9674]}}}}}}}}}, 0x66: {l: {0x3B: {c: [10731]}}}}}}}, 0x70: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [40]}, 0x6C: {l: {0x74: {l: {0x3B: {c: [10643]}}}}}}}}}}}, 0x72: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x3B: {c: [8646]}}}}}}}, 0x63: {l: {0x6F: {l: {0x72: {l: {0x6E: {l: {0x65: {l: {0x72: {l: {0x3B: {c: [8991]}}}}}}}}}}}}}, 0x68: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [8651]}, 0x64: {l: {0x3B: {c: [10605]}}}}}}}}}, 0x6D: {l: {0x3B: {c: [8206]}}}, 0x74: {l: {0x72: {l: {0x69: {l: {0x3B: {c: [8895]}}}}}}}}}, 0x73: {l: {0x61: {l: {0x71: {l: {0x75: {l: {0x6F: {l: {0x3B: {c: [8249]}}}}}}}}}, 0x63: {l: {0x72: {l: {0x3B: {c: [120001]}}}}}, 0x68: {l: {0x3B: {c: [8624]}}}, 0x69: {l: {0x6D: {l: {0x3B: {c: [8818]}, 0x65: {l: {0x3B: {c: [10893]}}}, 0x67: {l: {0x3B: {c: [10895]}}}}}}}, 0x71: {l: {0x62: {l: {0x3B: {c: [91]}}}, 0x75: {l: {0x6F: {l: {0x3B: {c: [8216]}, 0x72: {l: {0x3B: {c: [8218]}}}}}}}}}, 0x74: {l: {0x72: {l: {0x6F: {l: {0x6B: {l: {0x3B: {c: [322]}}}}}}}}}}}, 0x74: {l: {0x63: {l: {0x63: {l: {0x3B: {c: [10918]}}}, 0x69: {l: {0x72: {l: {0x3B: {c: [10873]}}}}}}}, 0x3B: {c: [60]}, 0x64: {l: {0x6F: {l: {0x74: {l: {0x3B: {c: [8918]}}}}}}}, 0x68: {l: {0x72: {l: {0x65: {l: {0x65: {l: {0x3B: {c: [8907]}}}}}}}}}, 0x69: {l: {0x6D: {l: {0x65: {l: {0x73: {l: {0x3B: {c: [8905]}}}}}}}}}, 0x6C: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x3B: {c: [10614]}}}}}}}}}, 0x71: {l: {0x75: {l: {0x65: {l: {0x73: {l: {0x74: {l: {0x3B: {c: [10875]}}}}}}}}}}}, 0x72: {l: {0x69: {l: {0x3B: {c: [9667]}, 0x65: {l: {0x3B: {c: [8884]}}}, 0x66: {l: {0x3B: {c: [9666]}}}}}, 0x50: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [10646]}}}}}}}}}}, c: [60]}, 0x75: {l: {0x72: {l: {0x64: {l: {0x73: {l: {0x68: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [10570]}}}}}}}}}}}, 0x75: {l: {0x68: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [10598]}}}}}}}}}}}}}, 0x76: {l: {0x65: {l: {0x72: {l: {0x74: {l: {0x6E: {l: {0x65: {l: {0x71: {l: {0x71: {l: {0x3B: {c: [8808, 65024]}}}}}}}}}}}}}}}, 0x6E: {l: {0x45: {l: {0x3B: {c: [8808, 65024]}}}}}}}}}, | |
0x4C: {l: {0x61: {l: {0x63: {l: {0x75: {l: {0x74: {l: {0x65: {l: {0x3B: {c: [313]}}}}}}}}}, 0x6D: {l: {0x62: {l: {0x64: {l: {0x61: {l: {0x3B: {c: [923]}}}}}}}}}, 0x6E: {l: {0x67: {l: {0x3B: {c: [10218]}}}}}, 0x70: {l: {0x6C: {l: {0x61: {l: {0x63: {l: {0x65: {l: {0x74: {l: {0x72: {l: {0x66: {l: {0x3B: {c: [8466]}}}}}}}}}}}}}}}}}, 0x72: {l: {0x72: {l: {0x3B: {c: [8606]}}}}}}}, 0x63: {l: {0x61: {l: {0x72: {l: {0x6F: {l: {0x6E: {l: {0x3B: {c: [317]}}}}}}}}}, 0x65: {l: {0x64: {l: {0x69: {l: {0x6C: {l: {0x3B: {c: [315]}}}}}}}}}, 0x79: {l: {0x3B: {c: [1051]}}}}}, 0x65: {l: {0x66: {l: {0x74: {l: {0x41: {l: {0x6E: {l: {0x67: {l: {0x6C: {l: {0x65: {l: {0x42: {l: {0x72: {l: {0x61: {l: {0x63: {l: {0x6B: {l: {0x65: {l: {0x74: {l: {0x3B: {c: [10216]}}}}}}}}}}}}}}}}}}}}}}}, 0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x42: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [8676]}}}}}}}, 0x3B: {c: [8592]}, 0x52: {l: {0x69: {l: {0x67: {l: {0x68: {l: {0x74: {l: {0x41: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8646]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, 0x61: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8656]}}}}}}}}}}}, 0x43: {l: {0x65: {l: {0x69: {l: {0x6C: {l: {0x69: {l: {0x6E: {l: {0x67: {l: {0x3B: {c: [8968]}}}}}}}}}}}}}}}, 0x44: {l: {0x6F: {l: {0x75: {l: {0x62: {l: {0x6C: {l: {0x65: {l: {0x42: {l: {0x72: {l: {0x61: {l: {0x63: {l: {0x6B: {l: {0x65: {l: {0x74: {l: {0x3B: {c: [10214]}}}}}}}}}}}}}}}}}}}}}}}, 0x77: {l: {0x6E: {l: {0x54: {l: {0x65: {l: {0x65: {l: {0x56: {l: {0x65: {l: {0x63: {l: {0x74: {l: {0x6F: {l: {0x72: {l: {0x3B: {c: [10593]}}}}}}}}}}}}}}}}}}}, 0x56: {l: {0x65: {l: {0x63: {l: {0x74: {l: {0x6F: {l: {0x72: {l: {0x42: {l: {0x61: {l: {0x72: {l: {0x3B: {c: [10585]}}}}}}}, 0x3B: {c: [8643]}}}}}}}}}}}}}}}}}}}}}, 0x46: {l: {0x6C: {l: {0x6F: {l: {0x6F: {l: {0x72: {l: {0x3B: {c: [8970]}}}}}}}}}}}, 0x52: {l: {0x69: {l: {0x67: {l: {0x68: {l: {0x74: {l: {0x41: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8596]}}}}}}}}}}}, 0x56: {l: {0x65: {l: {0x63: {l: {0x74: {l: {0x6F: {l: {0x72: {l: {0x3B: {c: [10574]}}}}}}}}}}}}}}}}}}}}}}}, 0x72: {l: {0x69: {l: {0x67: {l: {0x68: {l: {0x74: {l: {0x61: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8660]}}}}}}}}}}}}}}}}}}}}}, 0x54: {l: {0x65: {l: {0x65: {l: {0x41: {l: {0x72: {l: {0x72: {l: {0x6F: {l: {0x77: {l: {0x3B: {c: [8612]}}}}}}}}}}}, 0x3B: {c: [8867]}, 0x56: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment