|
@@ -15,8 +15,8 @@ export default class Matcher {
|
|
|
/**
|
|
/**
|
|
|
* Creates new instance of Matcher.
|
|
* Creates new instance of Matcher.
|
|
|
*
|
|
*
|
|
|
- * @param {String|RegExp|module:engine/view/matcher~Pattern} [pattern] Match patterns.
|
|
|
|
|
- * See {@link module:engine/view/matcher~Matcher#add add method} for more information.
|
|
|
|
|
|
|
+ * @param {String|RegExp|Object} [pattern] Match patterns. See {@link module:engine/view/matcher~Matcher#add add method} for
|
|
|
|
|
+ * more information.
|
|
|
*/
|
|
*/
|
|
|
constructor( ...pattern ) {
|
|
constructor( ...pattern ) {
|
|
|
this._patterns = [];
|
|
this._patterns = [];
|
|
@@ -88,8 +88,8 @@ export default class Matcher {
|
|
|
*
|
|
*
|
|
|
* matcher.add( 'div', { class: 'foobar' } );
|
|
* matcher.add( 'div', { class: 'foobar' } );
|
|
|
*
|
|
*
|
|
|
- * @param {module:engine/view/matcher~Pattern|String|RegExp|Function} pattern Object describing pattern details.
|
|
|
|
|
- * If string or regular expression is provided it will be used to match element's name. Pattern can be also provided in a form
|
|
|
|
|
|
|
+ * @param {Object|String|RegExp|Function} pattern Object describing pattern details. If string or regular expression
|
|
|
|
|
+ * is provided it will be used to match element's name. Pattern can be also provided in a form
|
|
|
* of a function - then this function will be called with each {@link module:engine/view/element~Element element} as a parameter.
|
|
* of a function - then this function will be called with each {@link module:engine/view/element~Element element} as a parameter.
|
|
|
* Function's return value will be stored under `match` key of the object returned from
|
|
* Function's return value will be stored under `match` key of the object returned from
|
|
|
* {@link module:engine/view/matcher~Matcher#match match} or {@link module:engine/view/matcher~Matcher#matchAll matchAll} methods.
|
|
* {@link module:engine/view/matcher~Matcher#match match} or {@link module:engine/view/matcher~Matcher#matchAll matchAll} methods.
|
|
@@ -378,17 +378,3 @@ function matchStyles( patterns, element ) {
|
|
|
|
|
|
|
|
return match;
|
|
return match;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-/**
|
|
|
|
|
- * @typedef {Object} Pattern
|
|
|
|
|
- *
|
|
|
|
|
- * @param {String|RegExp} [name] Name or regular expression to match element's name.
|
|
|
|
|
- * @param {Object} [attribute] Object with key-value pairs representing attributes to match. Each object key
|
|
|
|
|
- * represents attribute name. Value under that key can be either a string or a regular expression and it will be
|
|
|
|
|
- * used to match attribute value.
|
|
|
|
|
- * @param {String|RegExp|Array} [class] Class name or array of class names to match. Each name can be
|
|
|
|
|
- * provided in a form of string or regular expression.
|
|
|
|
|
- * @param {Object} [style] Object with key-value pairs representing styles to match. Each object key
|
|
|
|
|
- * represents style name. Value under that key can be either a string or a regular expression and it will be used
|
|
|
|
|
- * to match style value.
|
|
|
|
|
- */
|
|
|