Edit File by line
/home/barbar84/www/wp-inclu.../js/codemirr...
File: csslint.js
}
[6000] Fix | Delete
} else if (this.simple[type]) {
[6001] Fix | Delete
result = this.simple[type](part);
[6002] Fix | Delete
if (result) {
[6003] Fix | Delete
expression.next();
[6004] Fix | Delete
}
[6005] Fix | Delete
} else if (this.complex[type] instanceof Matcher) {
[6006] Fix | Delete
result = this.complex[type].match(expression);
[6007] Fix | Delete
} else {
[6008] Fix | Delete
result = this.complex[type](expression);
[6009] Fix | Delete
}
[6010] Fix | Delete
[6011] Fix | Delete
return result;
[6012] Fix | Delete
},
[6013] Fix | Delete
[6014] Fix | Delete
[6015] Fix | Delete
simple: {
[6016] Fix | Delete
__proto__: null,
[6017] Fix | Delete
[6018] Fix | Delete
"<absolute-size>":
[6019] Fix | Delete
"xx-small | x-small | small | medium | large | x-large | xx-large",
[6020] Fix | Delete
[6021] Fix | Delete
"<animateable-feature>":
[6022] Fix | Delete
"scroll-position | contents | <animateable-feature-name>",
[6023] Fix | Delete
[6024] Fix | Delete
"<animateable-feature-name>": function(part) {
[6025] Fix | Delete
return this["<ident>"](part) &&
[6026] Fix | Delete
!/^(unset|initial|inherit|will-change|auto|scroll-position|contents)$/i.test(part);
[6027] Fix | Delete
},
[6028] Fix | Delete
[6029] Fix | Delete
"<angle>": function(part) {
[6030] Fix | Delete
return part.type === "angle";
[6031] Fix | Delete
},
[6032] Fix | Delete
[6033] Fix | Delete
"<attachment>": "scroll | fixed | local",
[6034] Fix | Delete
[6035] Fix | Delete
"<attr>": "attr()",
[6036] Fix | Delete
[6037] Fix | Delete
// inset() = inset( <shape-arg>{1,4} [round <border-radius>]? )
[6038] Fix | Delete
// circle() = circle( [<shape-radius>]? [at <position>]? )
[6039] Fix | Delete
// ellipse() = ellipse( [<shape-radius>{2}]? [at <position>]? )
[6040] Fix | Delete
// polygon() = polygon( [<fill-rule>,]? [<shape-arg> <shape-arg>]# )
[6041] Fix | Delete
"<basic-shape>": "inset() | circle() | ellipse() | polygon()",
[6042] Fix | Delete
[6043] Fix | Delete
"<bg-image>": "<image> | <gradient> | none",
[6044] Fix | Delete
[6045] Fix | Delete
"<border-style>":
[6046] Fix | Delete
"none | hidden | dotted | dashed | solid | double | groove | " +
[6047] Fix | Delete
"ridge | inset | outset",
[6048] Fix | Delete
[6049] Fix | Delete
"<border-width>": "<length> | thin | medium | thick",
[6050] Fix | Delete
[6051] Fix | Delete
"<box>": "padding-box | border-box | content-box",
[6052] Fix | Delete
[6053] Fix | Delete
"<clip-source>": "<uri>",
[6054] Fix | Delete
[6055] Fix | Delete
"<color>": function(part) {
[6056] Fix | Delete
return part.type === "color" || String(part) === "transparent" || String(part) === "currentColor";
[6057] Fix | Delete
},
[6058] Fix | Delete
[6059] Fix | Delete
// The SVG <color> spec doesn't include "currentColor" or "transparent" as a color.
[6060] Fix | Delete
"<color-svg>": function(part) {
[6061] Fix | Delete
return part.type === "color";
[6062] Fix | Delete
},
[6063] Fix | Delete
[6064] Fix | Delete
"<content>": "content()",
[6065] Fix | Delete
[6066] Fix | Delete
// https://www.w3.org/TR/css3-sizing/#width-height-keywords
[6067] Fix | Delete
"<content-sizing>":
[6068] Fix | Delete
"fill-available | -moz-available | -webkit-fill-available | " +
[6069] Fix | Delete
"max-content | -moz-max-content | -webkit-max-content | " +
[6070] Fix | Delete
"min-content | -moz-min-content | -webkit-min-content | " +
[6071] Fix | Delete
"fit-content | -moz-fit-content | -webkit-fit-content",
[6072] Fix | Delete
[6073] Fix | Delete
"<feature-tag-value>": function(part) {
[6074] Fix | Delete
return part.type === "function" && /^[A-Z0-9]{4}$/i.test(part);
[6075] Fix | Delete
},
[6076] Fix | Delete
[6077] Fix | Delete
// custom() isn't actually in the spec
[6078] Fix | Delete
"<filter-function>":
[6079] Fix | Delete
"blur() | brightness() | contrast() | custom() | " +
[6080] Fix | Delete
"drop-shadow() | grayscale() | hue-rotate() | invert() | " +
[6081] Fix | Delete
"opacity() | saturate() | sepia()",
[6082] Fix | Delete
[6083] Fix | Delete
"<flex-basis>": "<width>",
[6084] Fix | Delete
[6085] Fix | Delete
"<flex-direction>": "row | row-reverse | column | column-reverse",
[6086] Fix | Delete
[6087] Fix | Delete
"<flex-grow>": "<number>",
[6088] Fix | Delete
[6089] Fix | Delete
"<flex-shrink>": "<number>",
[6090] Fix | Delete
[6091] Fix | Delete
"<flex-wrap>": "nowrap | wrap | wrap-reverse",
[6092] Fix | Delete
[6093] Fix | Delete
"<font-size>":
[6094] Fix | Delete
"<absolute-size> | <relative-size> | <length> | <percentage>",
[6095] Fix | Delete
[6096] Fix | Delete
"<font-stretch>":
[6097] Fix | Delete
"normal | ultra-condensed | extra-condensed | condensed | " +
[6098] Fix | Delete
"semi-condensed | semi-expanded | expanded | extra-expanded | " +
[6099] Fix | Delete
"ultra-expanded",
[6100] Fix | Delete
[6101] Fix | Delete
"<font-style>": "normal | italic | oblique",
[6102] Fix | Delete
[6103] Fix | Delete
"<font-variant-caps>":
[6104] Fix | Delete
"small-caps | all-small-caps | petite-caps | all-petite-caps | " +
[6105] Fix | Delete
"unicase | titling-caps",
[6106] Fix | Delete
[6107] Fix | Delete
"<font-variant-css21>": "normal | small-caps",
[6108] Fix | Delete
[6109] Fix | Delete
"<font-weight>":
[6110] Fix | Delete
"normal | bold | bolder | lighter | " +
[6111] Fix | Delete
"100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900",
[6112] Fix | Delete
[6113] Fix | Delete
"<generic-family>":
[6114] Fix | Delete
"serif | sans-serif | cursive | fantasy | monospace",
[6115] Fix | Delete
[6116] Fix | Delete
"<geometry-box>": "<shape-box> | fill-box | stroke-box | view-box",
[6117] Fix | Delete
[6118] Fix | Delete
"<glyph-angle>": function(part) {
[6119] Fix | Delete
return part.type === "angle" && part.units === "deg";
[6120] Fix | Delete
},
[6121] Fix | Delete
[6122] Fix | Delete
"<gradient>": function(part) {
[6123] Fix | Delete
return part.type === "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?(?:repeating\-)?(?:radial\-|linear\-)?gradient/i.test(part);
[6124] Fix | Delete
},
[6125] Fix | Delete
[6126] Fix | Delete
"<icccolor>":
[6127] Fix | Delete
"cielab() | cielch() | cielchab() | " +
[6128] Fix | Delete
"icc-color() | icc-named-color()",
[6129] Fix | Delete
[6130] Fix | Delete
//any identifier
[6131] Fix | Delete
"<ident>": function(part) {
[6132] Fix | Delete
return part.type === "identifier" || part.wasIdent;
[6133] Fix | Delete
},
[6134] Fix | Delete
[6135] Fix | Delete
"<ident-not-generic-family>": function(part) {
[6136] Fix | Delete
return this["<ident>"](part) && !this["<generic-family>"](part);
[6137] Fix | Delete
},
[6138] Fix | Delete
[6139] Fix | Delete
"<image>": "<uri>",
[6140] Fix | Delete
[6141] Fix | Delete
"<integer>": function(part) {
[6142] Fix | Delete
return part.type === "integer";
[6143] Fix | Delete
},
[6144] Fix | Delete
[6145] Fix | Delete
"<length>": function(part) {
[6146] Fix | Delete
if (part.type === "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?calc/i.test(part)) {
[6147] Fix | Delete
return true;
[6148] Fix | Delete
} else {
[6149] Fix | Delete
return part.type === "length" || part.type === "number" || part.type === "integer" || String(part) === "0";
[6150] Fix | Delete
}
[6151] Fix | Delete
},
[6152] Fix | Delete
[6153] Fix | Delete
"<line>": function(part) {
[6154] Fix | Delete
return part.type === "integer";
[6155] Fix | Delete
},
[6156] Fix | Delete
[6157] Fix | Delete
"<line-height>": "<number> | <length> | <percentage> | normal",
[6158] Fix | Delete
[6159] Fix | Delete
"<margin-width>": "<length> | <percentage> | auto",
[6160] Fix | Delete
[6161] Fix | Delete
"<miterlimit>": function(part) {
[6162] Fix | Delete
return this["<number>"](part) && part.value >= 1;
[6163] Fix | Delete
},
[6164] Fix | Delete
[6165] Fix | Delete
"<nonnegative-length-or-percentage>": function(part) {
[6166] Fix | Delete
return (this["<length>"](part) || this["<percentage>"](part)) &&
[6167] Fix | Delete
(String(part) === "0" || part.type === "function" || (part.value) >= 0);
[6168] Fix | Delete
},
[6169] Fix | Delete
[6170] Fix | Delete
"<nonnegative-number-or-percentage>": function(part) {
[6171] Fix | Delete
return (this["<number>"](part) || this["<percentage>"](part)) &&
[6172] Fix | Delete
(String(part) === "0" || part.type === "function" || (part.value) >= 0);
[6173] Fix | Delete
},
[6174] Fix | Delete
[6175] Fix | Delete
"<number>": function(part) {
[6176] Fix | Delete
return part.type === "number" || this["<integer>"](part);
[6177] Fix | Delete
},
[6178] Fix | Delete
[6179] Fix | Delete
"<opacity-value>": function(part) {
[6180] Fix | Delete
return this["<number>"](part) && part.value >= 0 && part.value <= 1;
[6181] Fix | Delete
},
[6182] Fix | Delete
[6183] Fix | Delete
"<padding-width>": "<nonnegative-length-or-percentage>",
[6184] Fix | Delete
[6185] Fix | Delete
"<percentage>": function(part) {
[6186] Fix | Delete
return part.type === "percentage" || String(part) === "0";
[6187] Fix | Delete
},
[6188] Fix | Delete
[6189] Fix | Delete
"<relative-size>": "smaller | larger",
[6190] Fix | Delete
[6191] Fix | Delete
"<shape>": "rect() | inset-rect()",
[6192] Fix | Delete
[6193] Fix | Delete
"<shape-box>": "<box> | margin-box",
[6194] Fix | Delete
[6195] Fix | Delete
"<single-animation-direction>":
[6196] Fix | Delete
"normal | reverse | alternate | alternate-reverse",
[6197] Fix | Delete
[6198] Fix | Delete
"<single-animation-name>": function(part) {
[6199] Fix | Delete
return this["<ident>"](part) &&
[6200] Fix | Delete
/^-?[a-z_][-a-z0-9_]+$/i.test(part) &&
[6201] Fix | Delete
!/^(none|unset|initial|inherit)$/i.test(part);
[6202] Fix | Delete
},
[6203] Fix | Delete
[6204] Fix | Delete
"<string>": function(part) {
[6205] Fix | Delete
return part.type === "string";
[6206] Fix | Delete
},
[6207] Fix | Delete
[6208] Fix | Delete
"<time>": function(part) {
[6209] Fix | Delete
return part.type === "time";
[6210] Fix | Delete
},
[6211] Fix | Delete
[6212] Fix | Delete
"<uri>": function(part) {
[6213] Fix | Delete
return part.type === "uri";
[6214] Fix | Delete
},
[6215] Fix | Delete
[6216] Fix | Delete
"<width>": "<margin-width>"
[6217] Fix | Delete
},
[6218] Fix | Delete
[6219] Fix | Delete
complex: {
[6220] Fix | Delete
__proto__: null,
[6221] Fix | Delete
[6222] Fix | Delete
"<azimuth>":
[6223] Fix | Delete
"<angle>" +
[6224] Fix | Delete
" | " +
[6225] Fix | Delete
"[ [ left-side | far-left | left | center-left | center | " +
[6226] Fix | Delete
"center-right | right | far-right | right-side ] || behind ]" +
[6227] Fix | Delete
" | "+
[6228] Fix | Delete
"leftwards | rightwards",
[6229] Fix | Delete
[6230] Fix | Delete
"<bg-position>": "<position>#",
[6231] Fix | Delete
[6232] Fix | Delete
"<bg-size>":
[6233] Fix | Delete
"[ <length> | <percentage> | auto ]{1,2} | cover | contain",
[6234] Fix | Delete
[6235] Fix | Delete
"<border-image-slice>":
[6236] Fix | Delete
// [<number> | <percentage>]{1,4} && fill?
[6237] Fix | Delete
// *but* fill can appear between any of the numbers
[6238] Fix | Delete
Matcher.many([true /* first element is required */],
[6239] Fix | Delete
Matcher.cast("<nonnegative-number-or-percentage>"),
[6240] Fix | Delete
Matcher.cast("<nonnegative-number-or-percentage>"),
[6241] Fix | Delete
Matcher.cast("<nonnegative-number-or-percentage>"),
[6242] Fix | Delete
Matcher.cast("<nonnegative-number-or-percentage>"),
[6243] Fix | Delete
"fill"),
[6244] Fix | Delete
[6245] Fix | Delete
"<border-radius>":
[6246] Fix | Delete
"<nonnegative-length-or-percentage>{1,4} " +
[6247] Fix | Delete
"[ / <nonnegative-length-or-percentage>{1,4} ]?",
[6248] Fix | Delete
[6249] Fix | Delete
"<box-shadow>": "none | <shadow>#",
[6250] Fix | Delete
[6251] Fix | Delete
"<clip-path>": "<basic-shape> || <geometry-box>",
[6252] Fix | Delete
[6253] Fix | Delete
"<dasharray>":
[6254] Fix | Delete
// "list of comma and/or white space separated <length>s and
[6255] Fix | Delete
// <percentage>s". There is a non-negative constraint.
[6256] Fix | Delete
Matcher.cast("<nonnegative-length-or-percentage>")
[6257] Fix | Delete
.braces(1, Infinity, "#", Matcher.cast(",").question()),
[6258] Fix | Delete
[6259] Fix | Delete
"<family-name>":
[6260] Fix | Delete
// <string> | <IDENT>+
[6261] Fix | Delete
"<string> | <ident-not-generic-family> <ident>*",
[6262] Fix | Delete
[6263] Fix | Delete
"<filter-function-list>": "[ <filter-function> | <uri> ]+",
[6264] Fix | Delete
[6265] Fix | Delete
// https://www.w3.org/TR/2014/WD-css-flexbox-1-20140325/#flex-property
[6266] Fix | Delete
"<flex>":
[6267] Fix | Delete
"none | [ <flex-grow> <flex-shrink>? || <flex-basis> ]",
[6268] Fix | Delete
[6269] Fix | Delete
"<font-family>": "[ <generic-family> | <family-name> ]#",
[6270] Fix | Delete
[6271] Fix | Delete
"<font-shorthand>":
[6272] Fix | Delete
"[ <font-style> || <font-variant-css21> || " +
[6273] Fix | Delete
"<font-weight> || <font-stretch> ]? <font-size> " +
[6274] Fix | Delete
"[ / <line-height> ]? <font-family>",
[6275] Fix | Delete
[6276] Fix | Delete
"<font-variant-alternates>":
[6277] Fix | Delete
// stylistic(<feature-value-name>)
[6278] Fix | Delete
"stylistic() || " +
[6279] Fix | Delete
"historical-forms || " +
[6280] Fix | Delete
// styleset(<feature-value-name> #)
[6281] Fix | Delete
"styleset() || " +
[6282] Fix | Delete
// character-variant(<feature-value-name> #)
[6283] Fix | Delete
"character-variant() || " +
[6284] Fix | Delete
// swash(<feature-value-name>)
[6285] Fix | Delete
"swash() || " +
[6286] Fix | Delete
// ornaments(<feature-value-name>)
[6287] Fix | Delete
"ornaments() || " +
[6288] Fix | Delete
// annotation(<feature-value-name>)
[6289] Fix | Delete
"annotation()",
[6290] Fix | Delete
[6291] Fix | Delete
"<font-variant-ligatures>":
[6292] Fix | Delete
// <common-lig-values>
[6293] Fix | Delete
"[ common-ligatures | no-common-ligatures ] || " +
[6294] Fix | Delete
// <discretionary-lig-values>
[6295] Fix | Delete
"[ discretionary-ligatures | no-discretionary-ligatures ] || " +
[6296] Fix | Delete
// <historical-lig-values>
[6297] Fix | Delete
"[ historical-ligatures | no-historical-ligatures ] || " +
[6298] Fix | Delete
// <contextual-alt-values>
[6299] Fix | Delete
"[ contextual | no-contextual ]",
[6300] Fix | Delete
[6301] Fix | Delete
"<font-variant-numeric>":
[6302] Fix | Delete
// <numeric-figure-values>
[6303] Fix | Delete
"[ lining-nums | oldstyle-nums ] || " +
[6304] Fix | Delete
// <numeric-spacing-values>
[6305] Fix | Delete
"[ proportional-nums | tabular-nums ] || " +
[6306] Fix | Delete
// <numeric-fraction-values>
[6307] Fix | Delete
"[ diagonal-fractions | stacked-fractions ] || " +
[6308] Fix | Delete
"ordinal || slashed-zero",
[6309] Fix | Delete
[6310] Fix | Delete
"<font-variant-east-asian>":
[6311] Fix | Delete
// <east-asian-variant-values>
[6312] Fix | Delete
"[ jis78 | jis83 | jis90 | jis04 | simplified | traditional ] || " +
[6313] Fix | Delete
// <east-asian-width-values>
[6314] Fix | Delete
"[ full-width | proportional-width ] || " +
[6315] Fix | Delete
"ruby",
[6316] Fix | Delete
[6317] Fix | Delete
// Note that <color> here is "as defined in the SVG spec", which
[6318] Fix | Delete
// is more restrictive that the <color> defined in the CSS spec.
[6319] Fix | Delete
// none | currentColor | <color> [<icccolor>]? |
[6320] Fix | Delete
// <funciri> [ none | currentColor | <color> [<icccolor>]? ]?
[6321] Fix | Delete
"<paint>": "<paint-basic> | <uri> <paint-basic>?",
[6322] Fix | Delete
[6323] Fix | Delete
// Helper definition for <paint> above.
[6324] Fix | Delete
"<paint-basic>": "none | currentColor | <color-svg> <icccolor>?",
[6325] Fix | Delete
[6326] Fix | Delete
"<position>":
[6327] Fix | Delete
// Because our `alt` combinator is ordered, we need to test these
[6328] Fix | Delete
// in order from longest possible match to shortest.
[6329] Fix | Delete
"[ center | [ left | right ] [ <percentage> | <length> ]? ] && " +
[6330] Fix | Delete
"[ center | [ top | bottom ] [ <percentage> | <length> ]? ]" +
[6331] Fix | Delete
" | " +
[6332] Fix | Delete
"[ left | center | right | <percentage> | <length> ] " +
[6333] Fix | Delete
"[ top | center | bottom | <percentage> | <length> ]" +
[6334] Fix | Delete
" | " +
[6335] Fix | Delete
"[ left | center | right | top | bottom | <percentage> | <length> ]",
[6336] Fix | Delete
[6337] Fix | Delete
"<repeat-style>":
[6338] Fix | Delete
"repeat-x | repeat-y | [ repeat | space | round | no-repeat ]{1,2}",
[6339] Fix | Delete
[6340] Fix | Delete
"<shadow>":
[6341] Fix | Delete
//inset? && [ <length>{2,4} && <color>? ]
[6342] Fix | Delete
Matcher.many([true /* length is required */],
[6343] Fix | Delete
Matcher.cast("<length>").braces(2, 4), "inset", "<color>"),
[6344] Fix | Delete
[6345] Fix | Delete
"<text-decoration-color>":
[6346] Fix | Delete
"<color>",
[6347] Fix | Delete
[6348] Fix | Delete
"<text-decoration-line>":
[6349] Fix | Delete
"none | [ underline || overline || line-through || blink ]",
[6350] Fix | Delete
[6351] Fix | Delete
"<text-decoration-style>":
[6352] Fix | Delete
"solid | double | dotted | dashed | wavy",
[6353] Fix | Delete
[6354] Fix | Delete
"<will-change>":
[6355] Fix | Delete
"auto | <animateable-feature>#",
[6356] Fix | Delete
[6357] Fix | Delete
"<x-one-radius>":
[6358] Fix | Delete
//[ <length> | <percentage> ] [ <length> | <percentage> ]?
[6359] Fix | Delete
"[ <length> | <percentage> ]{1,2}"
[6360] Fix | Delete
}
[6361] Fix | Delete
});
[6362] Fix | Delete
[6363] Fix | Delete
Object.keys(ValidationTypes.simple).forEach(function(nt) {
[6364] Fix | Delete
var rule = ValidationTypes.simple[nt];
[6365] Fix | Delete
if (typeof rule === "string") {
[6366] Fix | Delete
ValidationTypes.simple[nt] = function(part) {
[6367] Fix | Delete
return ValidationTypes.isLiteral(part, rule);
[6368] Fix | Delete
};
[6369] Fix | Delete
}
[6370] Fix | Delete
});
[6371] Fix | Delete
[6372] Fix | Delete
Object.keys(ValidationTypes.complex).forEach(function(nt) {
[6373] Fix | Delete
var rule = ValidationTypes.complex[nt];
[6374] Fix | Delete
if (typeof rule === "string") {
[6375] Fix | Delete
ValidationTypes.complex[nt] = Matcher.parse(rule);
[6376] Fix | Delete
}
[6377] Fix | Delete
});
[6378] Fix | Delete
[6379] Fix | Delete
// Because this is defined relative to other complex validation types,
[6380] Fix | Delete
// we need to define it *after* the rest of the types are initialized.
[6381] Fix | Delete
ValidationTypes.complex["<font-variant>"] =
[6382] Fix | Delete
Matcher.oror({ expand: "<font-variant-ligatures>" },
[6383] Fix | Delete
{ expand: "<font-variant-alternates>" },
[6384] Fix | Delete
"<font-variant-caps>",
[6385] Fix | Delete
{ expand: "<font-variant-numeric>" },
[6386] Fix | Delete
{ expand: "<font-variant-east-asian>" });
[6387] Fix | Delete
[6388] Fix | Delete
},{"./Matcher":3}],22:[function(require,module,exports){
[6389] Fix | Delete
"use strict";
[6390] Fix | Delete
[6391] Fix | Delete
module.exports = {
[6392] Fix | Delete
Colors : require("./Colors"),
[6393] Fix | Delete
Combinator : require("./Combinator"),
[6394] Fix | Delete
Parser : require("./Parser"),
[6395] Fix | Delete
PropertyName : require("./PropertyName"),
[6396] Fix | Delete
PropertyValue : require("./PropertyValue"),
[6397] Fix | Delete
PropertyValuePart : require("./PropertyValuePart"),
[6398] Fix | Delete
Matcher : require("./Matcher"),
[6399] Fix | Delete
MediaFeature : require("./MediaFeature"),
[6400] Fix | Delete
MediaQuery : require("./MediaQuery"),
[6401] Fix | Delete
Selector : require("./Selector"),
[6402] Fix | Delete
SelectorPart : require("./SelectorPart"),
[6403] Fix | Delete
SelectorSubPart : require("./SelectorSubPart"),
[6404] Fix | Delete
Specificity : require("./Specificity"),
[6405] Fix | Delete
TokenStream : require("./TokenStream"),
[6406] Fix | Delete
Tokens : require("./Tokens"),
[6407] Fix | Delete
ValidationError : require("./ValidationError")
[6408] Fix | Delete
};
[6409] Fix | Delete
[6410] Fix | Delete
},{"./Colors":1,"./Combinator":2,"./Matcher":3,"./MediaFeature":4,"./MediaQuery":5,"./Parser":6,"./PropertyName":8,"./PropertyValue":9,"./PropertyValuePart":11,"./Selector":13,"./SelectorPart":14,"./SelectorSubPart":15,"./Specificity":16,"./TokenStream":17,"./Tokens":18,"./ValidationError":20}],23:[function(require,module,exports){
[6411] Fix | Delete
"use strict";
[6412] Fix | Delete
[6413] Fix | Delete
module.exports = EventTarget;
[6414] Fix | Delete
[6415] Fix | Delete
/**
[6416] Fix | Delete
* A generic base to inherit from for any object
[6417] Fix | Delete
* that needs event handling.
[6418] Fix | Delete
* @class EventTarget
[6419] Fix | Delete
* @constructor
[6420] Fix | Delete
*/
[6421] Fix | Delete
function EventTarget() {
[6422] Fix | Delete
[6423] Fix | Delete
/**
[6424] Fix | Delete
* The array of listeners for various events.
[6425] Fix | Delete
* @type Object
[6426] Fix | Delete
* @property _listeners
[6427] Fix | Delete
* @private
[6428] Fix | Delete
*/
[6429] Fix | Delete
this._listeners = Object.create(null);
[6430] Fix | Delete
}
[6431] Fix | Delete
[6432] Fix | Delete
EventTarget.prototype = {
[6433] Fix | Delete
[6434] Fix | Delete
//restore constructor
[6435] Fix | Delete
constructor: EventTarget,
[6436] Fix | Delete
[6437] Fix | Delete
/**
[6438] Fix | Delete
* Adds a listener for a given event type.
[6439] Fix | Delete
* @param {String} type The type of event to add a listener for.
[6440] Fix | Delete
* @param {Function} listener The function to call when the event occurs.
[6441] Fix | Delete
* @return {void}
[6442] Fix | Delete
* @method addListener
[6443] Fix | Delete
*/
[6444] Fix | Delete
addListener: function(type, listener) {
[6445] Fix | Delete
if (!this._listeners[type]) {
[6446] Fix | Delete
this._listeners[type] = [];
[6447] Fix | Delete
}
[6448] Fix | Delete
[6449] Fix | Delete
this._listeners[type].push(listener);
[6450] Fix | Delete
},
[6451] Fix | Delete
[6452] Fix | Delete
/**
[6453] Fix | Delete
* Fires an event based on the passed-in object.
[6454] Fix | Delete
* @param {Object|String} event An object with at least a 'type' attribute
[6455] Fix | Delete
* or a string indicating the event name.
[6456] Fix | Delete
* @return {void}
[6457] Fix | Delete
* @method fire
[6458] Fix | Delete
*/
[6459] Fix | Delete
fire: function(event) {
[6460] Fix | Delete
if (typeof event === "string") {
[6461] Fix | Delete
event = { type: event };
[6462] Fix | Delete
}
[6463] Fix | Delete
if (typeof event.target !== "undefined") {
[6464] Fix | Delete
event.target = this;
[6465] Fix | Delete
}
[6466] Fix | Delete
[6467] Fix | Delete
if (typeof event.type === "undefined") {
[6468] Fix | Delete
throw new Error("Event object missing 'type' property.");
[6469] Fix | Delete
}
[6470] Fix | Delete
[6471] Fix | Delete
if (this._listeners[event.type]) {
[6472] Fix | Delete
[6473] Fix | Delete
//create a copy of the array and use that so listeners can't chane
[6474] Fix | Delete
var listeners = this._listeners[event.type].concat();
[6475] Fix | Delete
for (var i=0, len=listeners.length; i < len; i++) {
[6476] Fix | Delete
listeners[i].call(this, event);
[6477] Fix | Delete
}
[6478] Fix | Delete
}
[6479] Fix | Delete
},
[6480] Fix | Delete
[6481] Fix | Delete
/**
[6482] Fix | Delete
* Removes a listener for a given event type.
[6483] Fix | Delete
* @param {String} type The type of event to remove a listener from.
[6484] Fix | Delete
* @param {Function} listener The function to remove from the event.
[6485] Fix | Delete
* @return {void}
[6486] Fix | Delete
* @method removeListener
[6487] Fix | Delete
*/
[6488] Fix | Delete
removeListener: function(type, listener) {
[6489] Fix | Delete
if (this._listeners[type]) {
[6490] Fix | Delete
var listeners = this._listeners[type];
[6491] Fix | Delete
for (var i=0, len=listeners.length; i < len; i++) {
[6492] Fix | Delete
if (listeners[i] === listener) {
[6493] Fix | Delete
listeners.splice(i, 1);
[6494] Fix | Delete
break;
[6495] Fix | Delete
}
[6496] Fix | Delete
}
[6497] Fix | Delete
[6498] Fix | Delete
[6499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function