@ -117,8 +117,8 @@ export default class Element extends Node {
const value_attribute = info . attributes . find ( node = > node . name === 'value' ) ;
const value_attribute = info . attributes . find ( node = > node . name === 'value' ) ;
if ( value_attribute ) {
if ( value_attribute ) {
component . error ( value_attribute , {
component . error ( value_attribute , {
code : ` textarea-duplicate-value ` ,
code : 'textarea-duplicate-value' ,
message : ` A <textarea> can have either a value attribute or (equivalently) child content, but not both `
message : 'A <textarea> can have either a value attribute or (equivalently) child content, but not both'
} ) ;
} ) ;
}
}
@ -222,7 +222,7 @@ export default class Element extends Node {
if ( a11y_distracting_elements . has ( this . name ) ) {
if ( a11y_distracting_elements . has ( this . name ) ) {
// no-distracting-elements
// no-distracting-elements
this . component . warn ( this , {
this . component . warn ( this , {
code : ` a11y-distracting-elements ` ,
code : 'a11y-distracting-elements' ,
message : ` A11y: Avoid < ${ this . name } > elements `
message : ` A11y: Avoid < ${ this . name } > elements `
} ) ;
} ) ;
}
}
@ -244,8 +244,8 @@ export default class Element extends Node {
if ( ! is_figure_parent ) {
if ( ! is_figure_parent ) {
this . component . warn ( this , {
this . component . warn ( this , {
code : ` a11y-structure ` ,
code : 'a11y-structure' ,
message : ` A11y: <figcaption> must be an immediate child of <figure> `
message : 'A11y: <figcaption> must be an immediate child of <figure>'
} ) ;
} ) ;
}
}
}
}
@ -261,8 +261,8 @@ export default class Element extends Node {
if ( index !== - 1 && ( index !== 0 && index !== children . length - 1 ) ) {
if ( index !== - 1 && ( index !== 0 && index !== children . length - 1 ) ) {
this . component . warn ( children [ index ] , {
this . component . warn ( children [ index ] , {
code : ` a11y-structure ` ,
code : 'a11y-structure' ,
message : ` A11y: <figcaption> must be first or last child of <figure> `
message : 'A11y: <figcaption> must be first or last child of <figure>'
} ) ;
} ) ;
}
}
}
}
@ -288,7 +288,7 @@ export default class Element extends Node {
if ( invisible_elements . has ( this . name ) ) {
if ( invisible_elements . has ( this . name ) ) {
// aria-unsupported-elements
// aria-unsupported-elements
component . warn ( attribute , {
component . warn ( attribute , {
code : ` a11y-aria-attributes ` ,
code : 'a11y-aria-attributes' ,
message : ` A11y: < ${ this . name } > should not have aria-* attributes `
message : ` A11y: < ${ this . name } > should not have aria-* attributes `
} ) ;
} ) ;
}
}
@ -300,14 +300,14 @@ export default class Element extends Node {
if ( match ) message += ` (did you mean ' ${ match } '?) ` ;
if ( match ) message += ` (did you mean ' ${ match } '?) ` ;
component . warn ( attribute , {
component . warn ( attribute , {
code : ` a11y-unknown-aria-attribute ` ,
code : 'a11y-unknown-aria-attribute' ,
message
message
} ) ;
} ) ;
}
}
if ( name === 'aria-hidden' && /^h[1-6]$/ . test ( this . name ) ) {
if ( name === 'aria-hidden' && /^h[1-6]$/ . test ( this . name ) ) {
component . warn ( attribute , {
component . warn ( attribute , {
code : ` a11y-hidden ` ,
code : 'a11y-hidden' ,
message : ` A11y: < ${ this . name } > element should not be hidden `
message : ` A11y: < ${ this . name } > element should not be hidden `
} ) ;
} ) ;
}
}
@ -318,7 +318,7 @@ export default class Element extends Node {
if ( invisible_elements . has ( this . name ) ) {
if ( invisible_elements . has ( this . name ) ) {
// aria-unsupported-elements
// aria-unsupported-elements
component . warn ( attribute , {
component . warn ( attribute , {
code : ` a11y-misplaced-role ` ,
code : 'a11y-misplaced-role' ,
message : ` A11y: < ${ this . name } > should not have role attribute `
message : ` A11y: < ${ this . name } > should not have role attribute `
} ) ;
} ) ;
}
}
@ -332,7 +332,7 @@ export default class Element extends Node {
if ( match ) message += ` (did you mean ' ${ match } '?) ` ;
if ( match ) message += ` (did you mean ' ${ match } '?) ` ;
component . warn ( attribute , {
component . warn ( attribute , {
code : ` a11y-unknown-role ` ,
code : 'a11y-unknown-role' ,
message
message
} ) ;
} ) ;
}
}
@ -341,24 +341,24 @@ export default class Element extends Node {
// no-access-key
// no-access-key
if ( name === 'accesskey' ) {
if ( name === 'accesskey' ) {
component . warn ( attribute , {
component . warn ( attribute , {
code : ` a11y-accesskey ` ,
code : 'a11y-accesskey' ,
message : ` A11y: Avoid using accesskey `
message : 'A11y: Avoid using accesskey'
} ) ;
} ) ;
}
}
// no-autofocus
// no-autofocus
if ( name === 'autofocus' ) {
if ( name === 'autofocus' ) {
component . warn ( attribute , {
component . warn ( attribute , {
code : ` a11y-autofocus ` ,
code : 'a11y-autofocus' ,
message : ` A11y: Avoid using autofocus `
message : 'A11y: Avoid using autofocus'
} ) ;
} ) ;
}
}
// scope
// scope
if ( name === 'scope' && this . name !== 'th' ) {
if ( name === 'scope' && this . name !== 'th' ) {
component . warn ( attribute , {
component . warn ( attribute , {
code : ` a11y-misplaced-scope ` ,
code : 'a11y-misplaced-scope' ,
message : ` A11y: The scope attribute should only be used with <th> elements `
message : 'A11y: The scope attribute should only be used with <th> elements'
} ) ;
} ) ;
}
}
@ -368,8 +368,8 @@ export default class Element extends Node {
// @ts-ignore todo is tabindex=true correct case?
// @ts-ignore todo is tabindex=true correct case?
if ( ! isNaN ( value ) && + value > 0 ) {
if ( ! isNaN ( value ) && + value > 0 ) {
component . warn ( attribute , {
component . warn ( attribute , {
code : ` a11y-positive-tabindex ` ,
code : 'a11y-positive-tabindex' ,
message : ` A11y: avoid tabindex values above zero `
message : 'A11y: avoid tabindex values above zero'
} ) ;
} ) ;
}
}
}
}
@ -377,14 +377,14 @@ export default class Element extends Node {
if ( name === 'slot' ) {
if ( name === 'slot' ) {
if ( ! attribute . is_static ) {
if ( ! attribute . is_static ) {
component . error ( attribute , {
component . error ( attribute , {
code : ` invalid-slot-attribute ` ,
code : 'invalid-slot-attribute' ,
message : ` slot attribute cannot have a dynamic value `
message : 'slot attribute cannot have a dynamic value'
} ) ;
} ) ;
}
}
if ( component . slot_outlets . has ( name ) ) {
if ( component . slot_outlets . has ( name ) ) {
component . error ( attribute , {
component . error ( attribute , {
code : ` duplicate-slot-attribute ` ,
code : 'duplicate-slot-attribute' ,
message : ` Duplicate ' ${ name } ' slot `
message : ` Duplicate ' ${ name } ' slot `
} ) ;
} ) ;
@ -401,7 +401,7 @@ export default class Element extends Node {
const message = ` Cannot place slotted elements inside an ${ type } -block ` ;
const message = ` Cannot place slotted elements inside an ${ type } -block ` ;
component . error ( attribute , {
component . error ( attribute , {
code : ` invalid-slotted-content ` ,
code : 'invalid-slotted-content' ,
message
message
} ) ;
} ) ;
}
}
@ -409,8 +409,8 @@ export default class Element extends Node {
if ( ! ancestor ) {
if ( ! ancestor ) {
component . error ( attribute , {
component . error ( attribute , {
code : ` invalid-slotted-content ` ,
code : 'invalid-slotted-content' ,
message : ` Element with a slot='...' attribute must be a descendant of a component or custom element `
message : 'Element with a slot=\'...\' attribute must be a descendant of a component or custom element'
} ) ;
} ) ;
}
}
}
}
@ -427,14 +427,14 @@ export default class Element extends Node {
if ( value === '' || value === '#' ) {
if ( value === '' || value === '#' ) {
component . warn ( attribute , {
component . warn ( attribute , {
code : ` a11y-invalid-attribute ` ,
code : 'a11y-invalid-attribute' ,
message : ` A11y: ' ${ value } ' is not a valid ${ attribute . name } attribute `
message : ` A11y: ' ${ value } ' is not a valid ${ attribute . name } attribute `
} ) ;
} ) ;
}
}
} else {
} else {
component . warn ( this , {
component . warn ( this , {
code : ` a11y-missing-attribute ` ,
code : 'a11y-missing-attribute' ,
message : ` A11y: <a> element should have an href attribute `
message : 'A11y: <a> element should have an href attribute'
} ) ;
} ) ;
}
}
}
}
@ -475,8 +475,8 @@ export default class Element extends Node {
if ( ! attribute . is_static ) {
if ( ! attribute . is_static ) {
component . error ( attribute , {
component . error ( attribute , {
code : ` invalid-type ` ,
code : 'invalid-type' ,
message : ` 'type' attribute cannot be dynamic if input uses two-way binding `
message : '\'type\' attribute cannot be dynamic if input uses two-way binding'
} ) ;
} ) ;
}
}
@ -484,8 +484,8 @@ export default class Element extends Node {
if ( value === true ) {
if ( value === true ) {
component . error ( attribute , {
component . error ( attribute , {
code : ` missing-type ` ,
code : 'missing-type' ,
message : ` 'type' attribute must be specified `
message : '\'type\' attribute must be specified'
} ) ;
} ) ;
}
}
@ -502,7 +502,7 @@ export default class Element extends Node {
this . name !== 'select'
this . name !== 'select'
) {
) {
component . error ( binding , {
component . error ( binding , {
code : ` invalid-binding ` ,
code : 'invalid-binding' ,
message : ` 'value' is not a valid binding on < ${ this . name } > elements `
message : ` 'value' is not a valid binding on < ${ this . name } > elements `
} ) ;
} ) ;
}
}
@ -514,8 +514,8 @@ export default class Element extends Node {
if ( attribute && ! attribute . is_static ) {
if ( attribute && ! attribute . is_static ) {
component . error ( attribute , {
component . error ( attribute , {
code : ` dynamic-multiple-attribute ` ,
code : 'dynamic-multiple-attribute' ,
message : ` 'multiple' attribute cannot be dynamic if select uses two-way binding `
message : '\'multiple\' attribute cannot be dynamic if select uses two-way binding'
} ) ;
} ) ;
}
}
} else {
} else {
@ -524,7 +524,7 @@ export default class Element extends Node {
} else if ( name === 'checked' || name === 'indeterminate' ) {
} else if ( name === 'checked' || name === 'indeterminate' ) {
if ( this . name !== 'input' ) {
if ( this . name !== 'input' ) {
component . error ( binding , {
component . error ( binding , {
code : ` invalid-binding ` ,
code : 'invalid-binding' ,
message : ` ' ${ name } ' is not a valid binding on < ${ this . name } > elements `
message : ` ' ${ name } ' is not a valid binding on < ${ this . name } > elements `
} ) ;
} ) ;
}
}
@ -533,13 +533,13 @@ export default class Element extends Node {
if ( type !== 'checkbox' ) {
if ( type !== 'checkbox' ) {
let message = ` ' ${ name } ' binding can only be used with <input type="checkbox"> ` ;
let message = ` ' ${ name } ' binding can only be used with <input type="checkbox"> ` ;
if ( type === 'radio' ) message += ` — for <input type="radio">, use 'group' binding ` ;
if ( type === 'radio' ) message += ' — for <input type="radio">, use \'group\' binding' ;
component . error ( binding , { code : ` invalid-binding ` , message } ) ;
component . error ( binding , { code : 'invalid-binding' , message } ) ;
}
}
} else if ( name === 'group' ) {
} else if ( name === 'group' ) {
if ( this . name !== 'input' ) {
if ( this . name !== 'input' ) {
component . error ( binding , {
component . error ( binding , {
code : ` invalid-binding ` ,
code : 'invalid-binding' ,
message : ` 'group' is not a valid binding on < ${ this . name } > elements `
message : ` 'group' is not a valid binding on < ${ this . name } > elements `
} ) ;
} ) ;
}
}
@ -548,14 +548,14 @@ export default class Element extends Node {
if ( type !== 'checkbox' && type !== 'radio' ) {
if ( type !== 'checkbox' && type !== 'radio' ) {
component . error ( binding , {
component . error ( binding , {
code : ` invalid-binding ` ,
code : 'invalid-binding' ,
message : ` 'group ' binding can only be used with <input type="checkbox"> or <input type="radio">`
message : '\'group\ ' binding can only be used with <input type="checkbox"> or <input type="radio">'
} ) ;
} ) ;
}
}
} else if ( name === 'files' ) {
} else if ( name === 'files' ) {
if ( this . name !== 'input' ) {
if ( this . name !== 'input' ) {
component . error ( binding , {
component . error ( binding , {
code : ` invalid-binding ` ,
code : 'invalid-binding' ,
message : ` 'files' is not a valid binding on < ${ this . name } > elements `
message : ` 'files' is not a valid binding on < ${ this . name } > elements `
} ) ;
} ) ;
}
}
@ -564,15 +564,15 @@ export default class Element extends Node {
if ( type !== 'file' ) {
if ( type !== 'file' ) {
component . error ( binding , {
component . error ( binding , {
code : ` invalid-binding ` ,
code : 'invalid-binding' ,
message : ` 'files' binding can only be used with <input type="file"> `
message : '\'files\' binding can only be used with <input type="file">'
} ) ;
} ) ;
}
}
} else if ( name === 'open' ) {
} else if ( name === 'open' ) {
if ( this . name !== 'details' ) {
if ( this . name !== 'details' ) {
component . error ( binding , {
component . error ( binding , {
code : ` invalid-binding ` ,
code : 'invalid-binding' ,
message : ` ' ${ name } ' binding can only be used with <details> `
message : ` ' ${ name } ' binding can only be used with <details> `
} ) ;
} ) ;
}
}
@ -588,7 +588,7 @@ export default class Element extends Node {
) {
) {
if ( this . name !== 'audio' && this . name !== 'video' ) {
if ( this . name !== 'audio' && this . name !== 'video' ) {
component . error ( binding , {
component . error ( binding , {
code : ` invalid-binding ` ,
code : 'invalid-binding' ,
message : ` ' ${ name } ' binding can only be used with <audio> or <video> `
message : ` ' ${ name } ' binding can only be used with <audio> or <video> `
} ) ;
} ) ;
}
}
@ -619,18 +619,18 @@ export default class Element extends Node {
if ( ! contenteditable ) {
if ( ! contenteditable ) {
component . error ( binding , {
component . error ( binding , {
code : ` missing-contenteditable-attribute ` ,
code : 'missing-contenteditable-attribute' ,
message : ` 'contenteditable' attribute is required for textContent and innerHTML two-way bindings `
message : '\'contenteditable\' attribute is required for textContent and innerHTML two-way bindings'
} ) ;
} ) ;
} else if ( contenteditable && ! contenteditable . is_static ) {
} else if ( contenteditable && ! contenteditable . is_static ) {
component . error ( contenteditable , {
component . error ( contenteditable , {
code : ` dynamic-contenteditable-attribute ` ,
code : 'dynamic-contenteditable-attribute' ,
message : ` 'contenteditable' attribute cannot be dynamic if element uses two-way binding `
message : '\'contenteditable\' attribute cannot be dynamic if element uses two-way binding'
} ) ;
} ) ;
}
}
} else if ( name !== 'this' ) {
} else if ( name !== 'this' ) {
component . error ( binding , {
component . error ( binding , {
code : ` invalid-binding ` ,
code : 'invalid-binding' ,
message : ` ' ${ binding . name } ' is not a valid binding `
message : ` ' ${ binding . name } ' is not a valid binding `
} ) ;
} ) ;
}
}
@ -642,7 +642,7 @@ export default class Element extends Node {
if ( this . children . length === 0 ) {
if ( this . children . length === 0 ) {
this . component . warn ( this , {
this . component . warn ( this , {
code : ` a11y-missing-content ` ,
code : 'a11y-missing-content' ,
message : ` A11y: < ${ this . name } > element should have child content `
message : ` A11y: < ${ this . name } > element should have child content `
} ) ;
} ) ;
}
}
@ -655,7 +655,7 @@ export default class Element extends Node {
if ( handler . modifiers . has ( 'passive' ) && handler . modifiers . has ( 'preventDefault' ) ) {
if ( handler . modifiers . has ( 'passive' ) && handler . modifiers . has ( 'preventDefault' ) ) {
component . error ( handler , {
component . error ( handler , {
code : 'invalid-event-modifier' ,
code : 'invalid-event-modifier' ,
message : ` The 'passive' and 'preventDefault' modifiers cannot be used together `
message : 'The \'passive\' and \'preventDefault\' modifiers cannot be used together'
} ) ;
} ) ;
}
}
@ -672,13 +672,13 @@ export default class Element extends Node {
if ( handler . can_make_passive ) {
if ( handler . can_make_passive ) {
component . warn ( handler , {
component . warn ( handler , {
code : 'redundant-event-modifier' ,
code : 'redundant-event-modifier' ,
message : ` Touch event handlers that don't use the 'event' object are passive by default `
message : 'Touch event handlers that don\'t use the \'event\' object are passive by default'
} ) ;
} ) ;
}
}
} else {
} else {
component . warn ( handler , {
component . warn ( handler , {
code : 'redundant-event-modifier' ,
code : 'redundant-event-modifier' ,
message : ` The passive modifier only works with wheel and touch events `
message : 'The passive modifier only works with wheel and touch events'
} ) ;
} ) ;
}
}
}
}
@ -744,7 +744,7 @@ function should_have_attribute(
attributes [ 0 ] ;
attributes [ 0 ] ;
node . component . warn ( node , {
node . component . warn ( node , {
code : ` a11y-missing-attribute ` ,
code : 'a11y-missing-attribute' ,
message : ` A11y: < ${ name } > element should have ${ article } ${ sequence } attribute `
message : ` A11y: < ${ name } > element should have ${ article } ${ sequence } attribute `
} ) ;
} ) ;
}
}