parent
							
								
									93deff6c33
								
							
						
					
					
						commit
						d309f7799c
					
				| @ -33,7 +33,8 @@ const OBJECT = 'object'; | |||||||
|  * An `element` may inherit additional properties from `parentElement` If no `^parentElement` is |  * An `element` may inherit additional properties from `parentElement` If no `^parentElement` is | ||||||
|  * specified then `""` (blank) element is assumed. |  * specified then `""` (blank) element is assumed. | ||||||
|  * |  * | ||||||
|  * NOTE: The blank element inherits from root `[Element]` element, the super element of all elements. |  * NOTE: The blank element inherits from root `[Element]` element, the super element of all | ||||||
|  |  * elements. | ||||||
|  * |  * | ||||||
|  * NOTE an element prefix such as `:svg:` has no special meaning to the schema. |  * NOTE an element prefix such as `:svg:` has no special meaning to the schema. | ||||||
|  * |  * | ||||||
| @ -71,161 +72,167 @@ const OBJECT = 'object'; | |||||||
| //
 | //
 | ||||||
| // =================================================================================================
 | // =================================================================================================
 | ||||||
| 
 | 
 | ||||||
| const SCHEMA: string[] = ([ | const SCHEMA: | ||||||
|   '[Element]|textContent,%classList,className,id,innerHTML,*beforecopy,*beforecut,*beforepaste,*copy,*cut,*paste,*search,*selectstart,*webkitfullscreenchange,*webkitfullscreenerror,*wheel,outerHTML,#scrollLeft,#scrollTop', |     string[] = | ||||||
|   '[HTMLElement]^[Element]|accessKey,contentEditable,dir,!draggable,!hidden,innerText,lang,*abort,*beforecopy,*beforecut,*beforepaste,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*copy,*cuechange,*cut,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*message,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*mozfullscreenchange,*mozfullscreenerror,*mozpointerlockchange,*mozpointerlockerror,*paste,*pause,*play,*playing,*progress,*ratechange,*reset,*resize,*scroll,*search,*seeked,*seeking,*select,*selectstart,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,*webglcontextcreationerror,*webglcontextlost,*webglcontextrestored,*webkitfullscreenchange,*webkitfullscreenerror,*wheel,outerText,!spellcheck,%style,#tabIndex,title,!translate', |         [ | ||||||
|   'abbr,address,article,aside,b,bdi,bdo,cite,code,dd,dfn,dt,em,figcaption,figure,footer,header,i,kbd,main,mark,nav,noscript,rb,rp,rt,rtc,ruby,s,samp,section,small,strong,sub,sup,u,var,wbr^[HTMLElement]|accessKey,contentEditable,dir,!draggable,!hidden,innerText,lang,*abort,*beforecopy,*beforecut,*beforepaste,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*copy,*cuechange,*cut,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*message,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*mozfullscreenchange,*mozfullscreenerror,*mozpointerlockchange,*mozpointerlockerror,*paste,*pause,*play,*playing,*progress,*ratechange,*reset,*resize,*scroll,*search,*seeked,*seeking,*select,*selectstart,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,*webglcontextcreationerror,*webglcontextlost,*webglcontextrestored,*webkitfullscreenchange,*webkitfullscreenerror,*wheel,outerText,!spellcheck,%style,#tabIndex,title,!translate', |           '[Element]|textContent,%classList,className,id,innerHTML,*beforecopy,*beforecut,*beforepaste,*copy,*cut,*paste,*search,*selectstart,*webkitfullscreenchange,*webkitfullscreenerror,*wheel,outerHTML,#scrollLeft,#scrollTop', | ||||||
|   'media^[HTMLElement]|!autoplay,!controls,%crossOrigin,#currentTime,!defaultMuted,#defaultPlaybackRate,!disableRemotePlayback,!loop,!muted,*encrypted,#playbackRate,preload,src,%srcObject,#volume', |           '[HTMLElement]^[Element]|accessKey,contentEditable,dir,!draggable,!hidden,innerText,lang,*abort,*beforecopy,*beforecut,*beforepaste,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*copy,*cuechange,*cut,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*message,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*mozfullscreenchange,*mozfullscreenerror,*mozpointerlockchange,*mozpointerlockerror,*paste,*pause,*play,*playing,*progress,*ratechange,*reset,*resize,*scroll,*search,*seeked,*seeking,*select,*selectstart,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,*webglcontextcreationerror,*webglcontextlost,*webglcontextrestored,*webkitfullscreenchange,*webkitfullscreenerror,*wheel,outerText,!spellcheck,%style,#tabIndex,title,!translate', | ||||||
|   ':svg:^[HTMLElement]|*abort,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*cuechange,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*pause,*play,*playing,*progress,*ratechange,*reset,*resize,*scroll,*seeked,*seeking,*select,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,%style,#tabIndex', |           'abbr,address,article,aside,b,bdi,bdo,cite,code,dd,dfn,dt,em,figcaption,figure,footer,header,i,kbd,main,mark,nav,noscript,rb,rp,rt,rtc,ruby,s,samp,section,small,strong,sub,sup,u,var,wbr^[HTMLElement]|accessKey,contentEditable,dir,!draggable,!hidden,innerText,lang,*abort,*beforecopy,*beforecut,*beforepaste,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*copy,*cuechange,*cut,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*message,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*mozfullscreenchange,*mozfullscreenerror,*mozpointerlockchange,*mozpointerlockerror,*paste,*pause,*play,*playing,*progress,*ratechange,*reset,*resize,*scroll,*search,*seeked,*seeking,*select,*selectstart,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,*webglcontextcreationerror,*webglcontextlost,*webglcontextrestored,*webkitfullscreenchange,*webkitfullscreenerror,*wheel,outerText,!spellcheck,%style,#tabIndex,title,!translate', | ||||||
|   ':svg:graphics^:svg:|', |           'media^[HTMLElement]|!autoplay,!controls,%crossOrigin,#currentTime,!defaultMuted,#defaultPlaybackRate,!disableRemotePlayback,!loop,!muted,*encrypted,#playbackRate,preload,src,%srcObject,#volume', | ||||||
|   ':svg:animation^:svg:|*begin,*end,*repeat', |           ':svg:^[HTMLElement]|*abort,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*cuechange,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*pause,*play,*playing,*progress,*ratechange,*reset,*resize,*scroll,*seeked,*seeking,*select,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,%style,#tabIndex', | ||||||
|   ':svg:geometry^:svg:|', |           ':svg:graphics^:svg:|', | ||||||
|   ':svg:componentTransferFunction^:svg:|', |           ':svg:animation^:svg:|*begin,*end,*repeat', | ||||||
|   ':svg:gradient^:svg:|', |           ':svg:geometry^:svg:|', | ||||||
|   ':svg:textContent^:svg:graphics|', |           ':svg:componentTransferFunction^:svg:|', | ||||||
|   ':svg:textPositioning^:svg:textContent|', |           ':svg:gradient^:svg:|', | ||||||
|   'a^[HTMLElement]|charset,coords,download,hash,host,hostname,href,hreflang,name,password,pathname,ping,port,protocol,referrerPolicy,rel,rev,search,shape,target,text,type,username', |           ':svg:textContent^:svg:graphics|', | ||||||
|   'area^[HTMLElement]|alt,coords,hash,host,hostname,href,!noHref,password,pathname,ping,port,protocol,referrerPolicy,search,shape,target,username', |           ':svg:textPositioning^:svg:textContent|', | ||||||
|   'audio^media|', |           'a^[HTMLElement]|charset,coords,download,hash,host,hostname,href,hreflang,name,password,pathname,ping,port,protocol,referrerPolicy,rel,rev,search,shape,target,text,type,username', | ||||||
|   'br^[HTMLElement]|clear', |           'area^[HTMLElement]|alt,coords,hash,host,hostname,href,!noHref,password,pathname,ping,port,protocol,referrerPolicy,search,shape,target,username', | ||||||
|   'base^[HTMLElement]|href,target', |           'audio^media|', | ||||||
|   'body^[HTMLElement]|aLink,background,bgColor,link,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,text,vLink', |           'br^[HTMLElement]|clear', | ||||||
|   'button^[HTMLElement]|!autofocus,!disabled,formAction,formEnctype,formMethod,!formNoValidate,formTarget,name,type,value', |           'base^[HTMLElement]|href,target', | ||||||
|   'canvas^[HTMLElement]|#height,#width', |           'body^[HTMLElement]|aLink,background,bgColor,link,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,text,vLink', | ||||||
|   'content^[HTMLElement]|select', |           'button^[HTMLElement]|!autofocus,!disabled,formAction,formEnctype,formMethod,!formNoValidate,formTarget,name,type,value', | ||||||
|   'dl^[HTMLElement]|!compact', |           'canvas^[HTMLElement]|#height,#width', | ||||||
|   'datalist^[HTMLElement]|', |           'content^[HTMLElement]|select', | ||||||
|   'details^[HTMLElement]|!open', |           'dl^[HTMLElement]|!compact', | ||||||
|   'dialog^[HTMLElement]|!open,returnValue', |           'datalist^[HTMLElement]|', | ||||||
|   'dir^[HTMLElement]|!compact', |           'details^[HTMLElement]|!open', | ||||||
|   'div^[HTMLElement]|align', |           'dialog^[HTMLElement]|!open,returnValue', | ||||||
|   'embed^[HTMLElement]|align,height,name,src,type,width', |           'dir^[HTMLElement]|!compact', | ||||||
|   'fieldset^[HTMLElement]|!disabled,name', |           'div^[HTMLElement]|align', | ||||||
|   'font^[HTMLElement]|color,face,size', |           'embed^[HTMLElement]|align,height,name,src,type,width', | ||||||
|   'form^[HTMLElement]|acceptCharset,action,autocomplete,encoding,enctype,method,name,!noValidate,target', |           'fieldset^[HTMLElement]|!disabled,name', | ||||||
|   'frame^[HTMLElement]|frameBorder,longDesc,marginHeight,marginWidth,name,!noResize,scrolling,src', |           'font^[HTMLElement]|color,face,size', | ||||||
|   'frameset^[HTMLElement]|cols,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,rows', |           'form^[HTMLElement]|acceptCharset,action,autocomplete,encoding,enctype,method,name,!noValidate,target', | ||||||
|   'hr^[HTMLElement]|align,color,!noShade,size,width', |           'frame^[HTMLElement]|frameBorder,longDesc,marginHeight,marginWidth,name,!noResize,scrolling,src', | ||||||
|   'head^[HTMLElement]|', |           'frameset^[HTMLElement]|cols,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,rows', | ||||||
|   'h1,h2,h3,h4,h5,h6^[HTMLElement]|align', |           'hr^[HTMLElement]|align,color,!noShade,size,width', | ||||||
|   'html^[HTMLElement]|version', |           'head^[HTMLElement]|', | ||||||
|   'iframe^[HTMLElement]|align,!allowFullscreen,frameBorder,height,longDesc,marginHeight,marginWidth,name,referrerPolicy,%sandbox,scrolling,src,srcdoc,width', |           'h1,h2,h3,h4,h5,h6^[HTMLElement]|align', | ||||||
|   'img^[HTMLElement]|align,alt,border,%crossOrigin,#height,#hspace,!isMap,longDesc,lowsrc,name,referrerPolicy,sizes,src,srcset,useMap,#vspace,#width', |           'html^[HTMLElement]|version', | ||||||
|   'input^[HTMLElement]|accept,align,alt,autocapitalize,autocomplete,!autofocus,!checked,!defaultChecked,defaultValue,dirName,!disabled,%files,formAction,formEnctype,formMethod,!formNoValidate,formTarget,#height,!incremental,!indeterminate,max,#maxLength,min,#minLength,!multiple,name,pattern,placeholder,!readOnly,!required,selectionDirection,#selectionEnd,#selectionStart,#size,src,step,type,useMap,value,%valueAsDate,#valueAsNumber,#width', |           'iframe^[HTMLElement]|align,!allowFullscreen,frameBorder,height,longDesc,marginHeight,marginWidth,name,referrerPolicy,%sandbox,scrolling,src,srcdoc,width', | ||||||
|   'keygen^[HTMLElement]|!autofocus,challenge,!disabled,keytype,name', |           'img^[HTMLElement]|align,alt,border,%crossOrigin,#height,#hspace,!isMap,longDesc,lowsrc,name,referrerPolicy,sizes,src,srcset,useMap,#vspace,#width', | ||||||
|   'li^[HTMLElement]|type,#value', |           'input^[HTMLElement]|accept,align,alt,autocapitalize,autocomplete,!autofocus,!checked,!defaultChecked,defaultValue,dirName,!disabled,%files,formAction,formEnctype,formMethod,!formNoValidate,formTarget,#height,!incremental,!indeterminate,max,#maxLength,min,#minLength,!multiple,name,pattern,placeholder,!readOnly,!required,selectionDirection,#selectionEnd,#selectionStart,#size,src,step,type,useMap,value,%valueAsDate,#valueAsNumber,#width', | ||||||
|   'label^[HTMLElement]|htmlFor', |           'keygen^[HTMLElement]|!autofocus,challenge,!disabled,keytype,name', | ||||||
|   'legend^[HTMLElement]|align', |           'li^[HTMLElement]|type,#value', | ||||||
|   'link^[HTMLElement]|as,charset,%crossOrigin,!disabled,href,hreflang,integrity,media,rel,%relList,rev,%sizes,target,type', |           'label^[HTMLElement]|htmlFor', | ||||||
|   'map^[HTMLElement]|name', |           'legend^[HTMLElement]|align', | ||||||
|   'marquee^[HTMLElement]|behavior,bgColor,direction,height,#hspace,#loop,#scrollAmount,#scrollDelay,!trueSpeed,#vspace,width', |           'link^[HTMLElement]|as,charset,%crossOrigin,!disabled,href,hreflang,integrity,media,rel,%relList,rev,%sizes,target,type', | ||||||
|   'menu^[HTMLElement]|!compact', |           'map^[HTMLElement]|name', | ||||||
|   'meta^[HTMLElement]|content,httpEquiv,name,scheme', |           'marquee^[HTMLElement]|behavior,bgColor,direction,height,#hspace,#loop,#scrollAmount,#scrollDelay,!trueSpeed,#vspace,width', | ||||||
|   'meter^[HTMLElement]|#high,#low,#max,#min,#optimum,#value', |           'menu^[HTMLElement]|!compact', | ||||||
|   'ins,del^[HTMLElement]|cite,dateTime', |           'meta^[HTMLElement]|content,httpEquiv,name,scheme', | ||||||
|   'ol^[HTMLElement]|!compact,!reversed,#start,type', |           'meter^[HTMLElement]|#high,#low,#max,#min,#optimum,#value', | ||||||
|   'object^[HTMLElement]|align,archive,border,code,codeBase,codeType,data,!declare,height,#hspace,name,standby,type,useMap,#vspace,width', |           'ins,del^[HTMLElement]|cite,dateTime', | ||||||
|   'optgroup^[HTMLElement]|!disabled,label', |           'ol^[HTMLElement]|!compact,!reversed,#start,type', | ||||||
|   'option^[HTMLElement]|!defaultSelected,!disabled,label,!selected,text,value', |           'object^[HTMLElement]|align,archive,border,code,codeBase,codeType,data,!declare,height,#hspace,name,standby,type,useMap,#vspace,width', | ||||||
|   'output^[HTMLElement]|defaultValue,%htmlFor,name,value', |           'optgroup^[HTMLElement]|!disabled,label', | ||||||
|   'p^[HTMLElement]|align', |           'option^[HTMLElement]|!defaultSelected,!disabled,label,!selected,text,value', | ||||||
|   'param^[HTMLElement]|name,type,value,valueType', |           'output^[HTMLElement]|defaultValue,%htmlFor,name,value', | ||||||
|   'picture^[HTMLElement]|', |           'p^[HTMLElement]|align', | ||||||
|   'pre^[HTMLElement]|#width', |           'param^[HTMLElement]|name,type,value,valueType', | ||||||
|   'progress^[HTMLElement]|#max,#value', |           'picture^[HTMLElement]|', | ||||||
|   'q,blockquote,cite^[HTMLElement]|', |           'pre^[HTMLElement]|#width', | ||||||
|   'script^[HTMLElement]|!async,charset,%crossOrigin,!defer,event,htmlFor,integrity,src,text,type', |           'progress^[HTMLElement]|#max,#value', | ||||||
|   'select^[HTMLElement]|!autofocus,!disabled,#length,!multiple,name,!required,#selectedIndex,#size,value', |           'q,blockquote,cite^[HTMLElement]|', | ||||||
|   'shadow^[HTMLElement]|', |           'script^[HTMLElement]|!async,charset,%crossOrigin,!defer,event,htmlFor,integrity,src,text,type', | ||||||
|   'source^[HTMLElement]|media,sizes,src,srcset,type', |           'select^[HTMLElement]|!autofocus,!disabled,#length,!multiple,name,!required,#selectedIndex,#size,value', | ||||||
|   'span^[HTMLElement]|', |           'shadow^[HTMLElement]|', | ||||||
|   'style^[HTMLElement]|!disabled,media,type', |           'source^[HTMLElement]|media,sizes,src,srcset,type', | ||||||
|   'caption^[HTMLElement]|align', |           'span^[HTMLElement]|', | ||||||
|   'th,td^[HTMLElement]|abbr,align,axis,bgColor,ch,chOff,#colSpan,headers,height,!noWrap,#rowSpan,scope,vAlign,width', |           'style^[HTMLElement]|!disabled,media,type', | ||||||
|   'col,colgroup^[HTMLElement]|align,ch,chOff,#span,vAlign,width', |           'caption^[HTMLElement]|align', | ||||||
|   'table^[HTMLElement]|align,bgColor,border,%caption,cellPadding,cellSpacing,frame,rules,summary,%tFoot,%tHead,width', |           'th,td^[HTMLElement]|abbr,align,axis,bgColor,ch,chOff,#colSpan,headers,height,!noWrap,#rowSpan,scope,vAlign,width', | ||||||
|   'tr^[HTMLElement]|align,bgColor,ch,chOff,vAlign', |           'col,colgroup^[HTMLElement]|align,ch,chOff,#span,vAlign,width', | ||||||
|   'tfoot,thead,tbody^[HTMLElement]|align,ch,chOff,vAlign', |           'table^[HTMLElement]|align,bgColor,border,%caption,cellPadding,cellSpacing,frame,rules,summary,%tFoot,%tHead,width', | ||||||
|   'template^[HTMLElement]|', |           'tr^[HTMLElement]|align,bgColor,ch,chOff,vAlign', | ||||||
|   'textarea^[HTMLElement]|autocapitalize,!autofocus,#cols,defaultValue,dirName,!disabled,#maxLength,#minLength,name,placeholder,!readOnly,!required,#rows,selectionDirection,#selectionEnd,#selectionStart,value,wrap', |           'tfoot,thead,tbody^[HTMLElement]|align,ch,chOff,vAlign', | ||||||
|   'title^[HTMLElement]|text', |           'template^[HTMLElement]|', | ||||||
|   'track^[HTMLElement]|!default,kind,label,src,srclang', |           'textarea^[HTMLElement]|autocapitalize,!autofocus,#cols,defaultValue,dirName,!disabled,#maxLength,#minLength,name,placeholder,!readOnly,!required,#rows,selectionDirection,#selectionEnd,#selectionStart,value,wrap', | ||||||
|   'ul^[HTMLElement]|!compact,type', |           'title^[HTMLElement]|text', | ||||||
|   'unknown^[HTMLElement]|', |           'track^[HTMLElement]|!default,kind,label,src,srclang', | ||||||
|   'video^media|#height,poster,#width', |           'ul^[HTMLElement]|!compact,type', | ||||||
|   ':svg:a^:svg:graphics|', |           'unknown^[HTMLElement]|', | ||||||
|   ':svg:animate^:svg:animation|', |           'video^media|#height,poster,#width', | ||||||
|   ':svg:animateMotion^:svg:animation|', |           ':svg:a^:svg:graphics|', | ||||||
|   ':svg:animateTransform^:svg:animation|', |           ':svg:animate^:svg:animation|', | ||||||
|   ':svg:circle^:svg:geometry|', |           ':svg:animateMotion^:svg:animation|', | ||||||
|   ':svg:clipPath^:svg:graphics|', |           ':svg:animateTransform^:svg:animation|', | ||||||
|   ':svg:cursor^:svg:|', |           ':svg:circle^:svg:geometry|', | ||||||
|   ':svg:defs^:svg:graphics|', |           ':svg:clipPath^:svg:graphics|', | ||||||
|   ':svg:desc^:svg:|', |           ':svg:cursor^:svg:|', | ||||||
|   ':svg:discard^:svg:|', |           ':svg:defs^:svg:graphics|', | ||||||
|   ':svg:ellipse^:svg:geometry|', |           ':svg:desc^:svg:|', | ||||||
|   ':svg:feBlend^:svg:|', |           ':svg:discard^:svg:|', | ||||||
|   ':svg:feColorMatrix^:svg:|', |           ':svg:ellipse^:svg:geometry|', | ||||||
|   ':svg:feComponentTransfer^:svg:|', |           ':svg:feBlend^:svg:|', | ||||||
|   ':svg:feComposite^:svg:|', |           ':svg:feColorMatrix^:svg:|', | ||||||
|   ':svg:feConvolveMatrix^:svg:|', |           ':svg:feComponentTransfer^:svg:|', | ||||||
|   ':svg:feDiffuseLighting^:svg:|', |           ':svg:feComposite^:svg:|', | ||||||
|   ':svg:feDisplacementMap^:svg:|', |           ':svg:feConvolveMatrix^:svg:|', | ||||||
|   ':svg:feDistantLight^:svg:|', |           ':svg:feDiffuseLighting^:svg:|', | ||||||
|   ':svg:feDropShadow^:svg:|', |           ':svg:feDisplacementMap^:svg:|', | ||||||
|   ':svg:feFlood^:svg:|', |           ':svg:feDistantLight^:svg:|', | ||||||
|   ':svg:feFuncA^:svg:componentTransferFunction|', |           ':svg:feDropShadow^:svg:|', | ||||||
|   ':svg:feFuncB^:svg:componentTransferFunction|', |           ':svg:feFlood^:svg:|', | ||||||
|   ':svg:feFuncG^:svg:componentTransferFunction|', |           ':svg:feFuncA^:svg:componentTransferFunction|', | ||||||
|   ':svg:feFuncR^:svg:componentTransferFunction|', |           ':svg:feFuncB^:svg:componentTransferFunction|', | ||||||
|   ':svg:feGaussianBlur^:svg:|', |           ':svg:feFuncG^:svg:componentTransferFunction|', | ||||||
|   ':svg:feImage^:svg:|', |           ':svg:feFuncR^:svg:componentTransferFunction|', | ||||||
|   ':svg:feMerge^:svg:|', |           ':svg:feGaussianBlur^:svg:|', | ||||||
|   ':svg:feMergeNode^:svg:|', |           ':svg:feImage^:svg:|', | ||||||
|   ':svg:feMorphology^:svg:|', |           ':svg:feMerge^:svg:|', | ||||||
|   ':svg:feOffset^:svg:|', |           ':svg:feMergeNode^:svg:|', | ||||||
|   ':svg:fePointLight^:svg:|', |           ':svg:feMorphology^:svg:|', | ||||||
|   ':svg:feSpecularLighting^:svg:|', |           ':svg:feOffset^:svg:|', | ||||||
|   ':svg:feSpotLight^:svg:|', |           ':svg:fePointLight^:svg:|', | ||||||
|   ':svg:feTile^:svg:|', |           ':svg:feSpecularLighting^:svg:|', | ||||||
|   ':svg:feTurbulence^:svg:|', |           ':svg:feSpotLight^:svg:|', | ||||||
|   ':svg:filter^:svg:|', |           ':svg:feTile^:svg:|', | ||||||
|   ':svg:foreignObject^:svg:graphics|', |           ':svg:feTurbulence^:svg:|', | ||||||
|   ':svg:g^:svg:graphics|', |           ':svg:filter^:svg:|', | ||||||
|   ':svg:image^:svg:graphics|', |           ':svg:foreignObject^:svg:graphics|', | ||||||
|   ':svg:line^:svg:geometry|', |           ':svg:g^:svg:graphics|', | ||||||
|   ':svg:linearGradient^:svg:gradient|', |           ':svg:image^:svg:graphics|', | ||||||
|   ':svg:mpath^:svg:|', |           ':svg:line^:svg:geometry|', | ||||||
|   ':svg:marker^:svg:|', |           ':svg:linearGradient^:svg:gradient|', | ||||||
|   ':svg:mask^:svg:|', |           ':svg:mpath^:svg:|', | ||||||
|   ':svg:metadata^:svg:|', |           ':svg:marker^:svg:|', | ||||||
|   ':svg:path^:svg:geometry|', |           ':svg:mask^:svg:|', | ||||||
|   ':svg:pattern^:svg:|', |           ':svg:metadata^:svg:|', | ||||||
|   ':svg:polygon^:svg:geometry|', |           ':svg:path^:svg:geometry|', | ||||||
|   ':svg:polyline^:svg:geometry|', |           ':svg:pattern^:svg:|', | ||||||
|   ':svg:radialGradient^:svg:gradient|', |           ':svg:polygon^:svg:geometry|', | ||||||
|   ':svg:rect^:svg:geometry|', |           ':svg:polyline^:svg:geometry|', | ||||||
|   ':svg:svg^:svg:graphics|#currentScale,#zoomAndPan', |           ':svg:radialGradient^:svg:gradient|', | ||||||
|   ':svg:script^:svg:|type', |           ':svg:rect^:svg:geometry|', | ||||||
|   ':svg:set^:svg:animation|', |           ':svg:svg^:svg:graphics|#currentScale,#zoomAndPan', | ||||||
|   ':svg:stop^:svg:|', |           ':svg:script^:svg:|type', | ||||||
|   ':svg:style^:svg:|!disabled,media,title,type', |           ':svg:set^:svg:animation|', | ||||||
|   ':svg:switch^:svg:graphics|', |           ':svg:stop^:svg:|', | ||||||
|   ':svg:symbol^:svg:|', |           ':svg:style^:svg:|!disabled,media,title,type', | ||||||
|   ':svg:tspan^:svg:textPositioning|', |           ':svg:switch^:svg:graphics|', | ||||||
|   ':svg:text^:svg:textPositioning|', |           ':svg:symbol^:svg:|', | ||||||
|   ':svg:textPath^:svg:textContent|', |           ':svg:tspan^:svg:textPositioning|', | ||||||
|   ':svg:title^:svg:|', |           ':svg:text^:svg:textPositioning|', | ||||||
|   ':svg:use^:svg:graphics|', |           ':svg:textPath^:svg:textContent|', | ||||||
|   ':svg:view^:svg:|#zoomAndPan', |           ':svg:title^:svg:|', | ||||||
| ]); |           ':svg:use^:svg:graphics|', | ||||||
|  |           ':svg:view^:svg:|#zoomAndPan', | ||||||
|  |           'data^[HTMLElement]|value', | ||||||
|  |           'menuitem^[HTMLElement]|type,label,icon,!disabled,!checked,radiogroup,!default', | ||||||
|  |           'summary^[HTMLElement]|', | ||||||
|  |           'time^[HTMLElement]|dateTime', | ||||||
|  |         ]; | ||||||
| 
 | 
 | ||||||
| const _ATTR_TO_PROP: {[name: string]: string} = { | const _ATTR_TO_PROP: {[name: string]: string} = { | ||||||
|   'class': 'className', |   'class': 'className', | ||||||
|   'formaction': 'formAction', |   'formaction': 'formAction', | ||||||
|   'innerHtml': 'innerHTML', |   'innerHtml': 'innerHTML', | ||||||
|   'readonly': 'readOnly', |   'readonly': 'readOnly', | ||||||
|   'tabindex': 'tabIndex' |   'tabindex': 'tabIndex', | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| @Injectable() | @Injectable() | ||||||
|  | |||||||
| @ -31,6 +31,14 @@ export function main() { | |||||||
|       expect(registry.hasElement('abc', [])).toBeFalsy(); |       expect(registry.hasElement('abc', [])).toBeFalsy(); | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  |     // https://github.com/angular/angular/issues/11219
 | ||||||
|  |     it('should detect elements missing from chrome', () => { | ||||||
|  |       expect(registry.hasElement('data', [])).toBeTruthy(); | ||||||
|  |       expect(registry.hasElement('menuitem', [])).toBeTruthy(); | ||||||
|  |       expect(registry.hasElement('summary', [])).toBeTruthy(); | ||||||
|  |       expect(registry.hasElement('time', [])).toBeTruthy(); | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|     it('should detect properties on regular elements', () => { |     it('should detect properties on regular elements', () => { | ||||||
|       expect(registry.hasProperty('div', 'id', [])).toBeTruthy(); |       expect(registry.hasProperty('div', 'id', [])).toBeTruthy(); | ||||||
|       expect(registry.hasProperty('div', 'title', [])).toBeTruthy(); |       expect(registry.hasProperty('div', 'title', [])).toBeTruthy(); | ||||||
| @ -46,6 +54,16 @@ export function main() { | |||||||
|       expect(registry.hasProperty('div', 'unknown', [])).toBeFalsy(); |       expect(registry.hasProperty('div', 'unknown', [])).toBeFalsy(); | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  |     // https://github.com/angular/angular/issues/11219
 | ||||||
|  |     it('should detect properties on elements missing from Chrome', () => { | ||||||
|  |       expect(registry.hasProperty('data', 'value', [])).toBeTruthy(); | ||||||
|  | 
 | ||||||
|  |       expect(registry.hasProperty('menuitem', 'type', [])).toBeTruthy(); | ||||||
|  |       expect(registry.hasProperty('menuitem', 'default', [])).toBeTruthy(); | ||||||
|  | 
 | ||||||
|  |       expect(registry.hasProperty('time', 'dateTime', [])).toBeTruthy(); | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|     it('should detect different kinds of types', () => { |     it('should detect different kinds of types', () => { | ||||||
|       // inheritance: video => media => [HTMLElement] => [Element]
 |       // inheritance: video => media => [HTMLElement] => [Element]
 | ||||||
|       expect(registry.hasProperty('video', 'className', [])).toBeTruthy();   // from [Element]
 |       expect(registry.hasProperty('video', 'className', [])).toBeTruthy();   // from [Element]
 | ||||||
|  | |||||||
| @ -6,6 +6,8 @@ | |||||||
|  * found in the LICENSE file at https://angular.io/license
 |  * found in the LICENSE file at https://angular.io/license
 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | import {MapWrapper} from '../../src/facade/collection'; | ||||||
|  | 
 | ||||||
| const SVG_PREFIX = ':svg:'; | const SVG_PREFIX = ':svg:'; | ||||||
| 
 | 
 | ||||||
| // Element | Node interfaces
 | // Element | Node interfaces
 | ||||||
| @ -17,7 +19,24 @@ const ELEMENT_IF = '[Element]'; | |||||||
| const HTMLELEMENT_IF = '[HTMLElement]'; | const HTMLELEMENT_IF = '[HTMLElement]'; | ||||||
| 
 | 
 | ||||||
| const HTMLELEMENT_TAGS = | const HTMLELEMENT_TAGS = | ||||||
|   'abbr,address,article,aside,b,bdi,bdo,cite,code,dd,dfn,dt,em,figcaption,figure,footer,header,i,kbd,main,mark,nav,noscript,rb,rp,rt,rtc,ruby,s,samp,section,small,strong,sub,sup,u,var,wbr'; |     'abbr,address,article,aside,b,bdi,bdo,cite,code,dd,dfn,dt,em,figcaption,figure,footer,header,i,kbd,main,mark,nav,noscript,rb,rp,rt,rtc,ruby,s,samp,section,small,strong,sub,sup,u,var,wbr'; | ||||||
|  | 
 | ||||||
|  | const ALL_HTML_TAGS = | ||||||
|  |     // https://www.w3.org/TR/html5/index.html
 | ||||||
|  |     'a,abbr,address,area,article,aside,audio,b,base,bdi,bdo,blockquote,body,br,button,canvas,caption,cite,code,col,colgroup,data,datalist,dd,del,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hr,html,i,iframe,img,input,ins,kbd,keygen,label,legend,li,link,main,map,mark,meta,meter,nav,noscript,object,ol,optgroup,option,output,p,param,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,section,select,small,source,span,strong,style,sub,sup,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,u,ul,var,video,wbr,' + | ||||||
|  |     // https://html.spec.whatwg.org/
 | ||||||
|  |     'details,summary,menu,menuitem'; | ||||||
|  | 
 | ||||||
|  | // Elements missing from Chrome (HtmlUnknownElement), to be manually added
 | ||||||
|  | const MISSING_FROM_CHROME: {[el: string]: string[]} = { | ||||||
|  |   'data^[HTMLElement]': ['value'], | ||||||
|  |   // TODO(vicb): Figure out why Chrome and WhatWG do not agree on the props
 | ||||||
|  |   // 'menu^[HTMLElement]': ['type', 'label'],
 | ||||||
|  |   'menuitem^[HTMLElement]': | ||||||
|  |       ['type', 'label', 'icon', '!disabled', '!checked', 'radiogroup', '!default'], | ||||||
|  |   'summary^[HTMLElement]': [], | ||||||
|  |   'time^[HTMLElement]': ['dateTime'], | ||||||
|  | }; | ||||||
| 
 | 
 | ||||||
| const _G: any = global; | const _G: any = global; | ||||||
| const document: any = typeof _G['document'] == 'object' ? _G['document'] : null; | const document: any = typeof _G['document'] == 'object' ? _G['document'] : null; | ||||||
| @ -77,9 +96,29 @@ export function extractSchema(): Map<string, string[]> { | |||||||
| 
 | 
 | ||||||
|   types.forEach(type => { extractRecursiveProperties(visited, descMap, (window as any)[type]); }); |   types.forEach(type => { extractRecursiveProperties(visited, descMap, (window as any)[type]); }); | ||||||
| 
 | 
 | ||||||
|  |   // Add elements missed by Chrome auto-detection
 | ||||||
|  |   Object.keys(MISSING_FROM_CHROME).forEach(elHierarchy => { | ||||||
|  |     descMap.set(elHierarchy, MISSING_FROM_CHROME[elHierarchy]); | ||||||
|  |   }); | ||||||
|  | 
 | ||||||
|  |   assertNoMissingTags(descMap); | ||||||
|  | 
 | ||||||
|   return descMap; |   return descMap; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | function assertNoMissingTags(descMap: Map<string, string[]>): void { | ||||||
|  |   const extractedTags: string[] = []; | ||||||
|  | 
 | ||||||
|  |   MapWrapper.keys(descMap).forEach( | ||||||
|  |       (key: string) => { extractedTags.push(...key.split('|')[0].split('^')[0].split(',')); }); | ||||||
|  | 
 | ||||||
|  |   const missingTags = ALL_HTML_TAGS.split(',').filter(tag => extractedTags.indexOf(tag) == -1); | ||||||
|  | 
 | ||||||
|  |   if (missingTags.length) { | ||||||
|  |     throw new Error(`DOM schema misses tags: ${missingTags.join(',')}`); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
| function extractRecursiveProperties( | function extractRecursiveProperties( | ||||||
|     visited: {[name: string]: boolean}, descMap: Map<string, string[]>, type: Function): string { |     visited: {[name: string]: boolean}, descMap: Map<string, string[]>, type: Function): string { | ||||||
|   const name = extractName(type); |   const name = extractName(type); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user