parent
93deff6c33
commit
d309f7799c
|
@ -33,7 +33,8 @@ const OBJECT = 'object';
|
|||
* An `element` may inherit additional properties from `parentElement` If no `^parentElement` is
|
||||
* 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.
|
||||
*
|
||||
|
@ -71,161 +72,167 @@ const OBJECT = 'object';
|
|||
//
|
||||
// =================================================================================================
|
||||
|
||||
const SCHEMA: string[] = ([
|
||||
'[Element]|textContent,%classList,className,id,innerHTML,*beforecopy,*beforecut,*beforepaste,*copy,*cut,*paste,*search,*selectstart,*webkitfullscreenchange,*webkitfullscreenerror,*wheel,outerHTML,#scrollLeft,#scrollTop',
|
||||
'[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',
|
||||
'media^[HTMLElement]|!autoplay,!controls,%crossOrigin,#currentTime,!defaultMuted,#defaultPlaybackRate,!disableRemotePlayback,!loop,!muted,*encrypted,#playbackRate,preload,src,%srcObject,#volume',
|
||||
':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:graphics^:svg:|',
|
||||
':svg:animation^:svg:|*begin,*end,*repeat',
|
||||
':svg:geometry^:svg:|',
|
||||
':svg:componentTransferFunction^:svg:|',
|
||||
':svg:gradient^:svg:|',
|
||||
':svg:textContent^:svg:graphics|',
|
||||
':svg:textPositioning^:svg:textContent|',
|
||||
'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',
|
||||
'area^[HTMLElement]|alt,coords,hash,host,hostname,href,!noHref,password,pathname,ping,port,protocol,referrerPolicy,search,shape,target,username',
|
||||
'audio^media|',
|
||||
'br^[HTMLElement]|clear',
|
||||
'base^[HTMLElement]|href,target',
|
||||
'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',
|
||||
'button^[HTMLElement]|!autofocus,!disabled,formAction,formEnctype,formMethod,!formNoValidate,formTarget,name,type,value',
|
||||
'canvas^[HTMLElement]|#height,#width',
|
||||
'content^[HTMLElement]|select',
|
||||
'dl^[HTMLElement]|!compact',
|
||||
'datalist^[HTMLElement]|',
|
||||
'details^[HTMLElement]|!open',
|
||||
'dialog^[HTMLElement]|!open,returnValue',
|
||||
'dir^[HTMLElement]|!compact',
|
||||
'div^[HTMLElement]|align',
|
||||
'embed^[HTMLElement]|align,height,name,src,type,width',
|
||||
'fieldset^[HTMLElement]|!disabled,name',
|
||||
'font^[HTMLElement]|color,face,size',
|
||||
'form^[HTMLElement]|acceptCharset,action,autocomplete,encoding,enctype,method,name,!noValidate,target',
|
||||
'frame^[HTMLElement]|frameBorder,longDesc,marginHeight,marginWidth,name,!noResize,scrolling,src',
|
||||
'frameset^[HTMLElement]|cols,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,rows',
|
||||
'hr^[HTMLElement]|align,color,!noShade,size,width',
|
||||
'head^[HTMLElement]|',
|
||||
'h1,h2,h3,h4,h5,h6^[HTMLElement]|align',
|
||||
'html^[HTMLElement]|version',
|
||||
'iframe^[HTMLElement]|align,!allowFullscreen,frameBorder,height,longDesc,marginHeight,marginWidth,name,referrerPolicy,%sandbox,scrolling,src,srcdoc,width',
|
||||
'img^[HTMLElement]|align,alt,border,%crossOrigin,#height,#hspace,!isMap,longDesc,lowsrc,name,referrerPolicy,sizes,src,srcset,useMap,#vspace,#width',
|
||||
'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',
|
||||
'keygen^[HTMLElement]|!autofocus,challenge,!disabled,keytype,name',
|
||||
'li^[HTMLElement]|type,#value',
|
||||
'label^[HTMLElement]|htmlFor',
|
||||
'legend^[HTMLElement]|align',
|
||||
'link^[HTMLElement]|as,charset,%crossOrigin,!disabled,href,hreflang,integrity,media,rel,%relList,rev,%sizes,target,type',
|
||||
'map^[HTMLElement]|name',
|
||||
'marquee^[HTMLElement]|behavior,bgColor,direction,height,#hspace,#loop,#scrollAmount,#scrollDelay,!trueSpeed,#vspace,width',
|
||||
'menu^[HTMLElement]|!compact',
|
||||
'meta^[HTMLElement]|content,httpEquiv,name,scheme',
|
||||
'meter^[HTMLElement]|#high,#low,#max,#min,#optimum,#value',
|
||||
'ins,del^[HTMLElement]|cite,dateTime',
|
||||
'ol^[HTMLElement]|!compact,!reversed,#start,type',
|
||||
'object^[HTMLElement]|align,archive,border,code,codeBase,codeType,data,!declare,height,#hspace,name,standby,type,useMap,#vspace,width',
|
||||
'optgroup^[HTMLElement]|!disabled,label',
|
||||
'option^[HTMLElement]|!defaultSelected,!disabled,label,!selected,text,value',
|
||||
'output^[HTMLElement]|defaultValue,%htmlFor,name,value',
|
||||
'p^[HTMLElement]|align',
|
||||
'param^[HTMLElement]|name,type,value,valueType',
|
||||
'picture^[HTMLElement]|',
|
||||
'pre^[HTMLElement]|#width',
|
||||
'progress^[HTMLElement]|#max,#value',
|
||||
'q,blockquote,cite^[HTMLElement]|',
|
||||
'script^[HTMLElement]|!async,charset,%crossOrigin,!defer,event,htmlFor,integrity,src,text,type',
|
||||
'select^[HTMLElement]|!autofocus,!disabled,#length,!multiple,name,!required,#selectedIndex,#size,value',
|
||||
'shadow^[HTMLElement]|',
|
||||
'source^[HTMLElement]|media,sizes,src,srcset,type',
|
||||
'span^[HTMLElement]|',
|
||||
'style^[HTMLElement]|!disabled,media,type',
|
||||
'caption^[HTMLElement]|align',
|
||||
'th,td^[HTMLElement]|abbr,align,axis,bgColor,ch,chOff,#colSpan,headers,height,!noWrap,#rowSpan,scope,vAlign,width',
|
||||
'col,colgroup^[HTMLElement]|align,ch,chOff,#span,vAlign,width',
|
||||
'table^[HTMLElement]|align,bgColor,border,%caption,cellPadding,cellSpacing,frame,rules,summary,%tFoot,%tHead,width',
|
||||
'tr^[HTMLElement]|align,bgColor,ch,chOff,vAlign',
|
||||
'tfoot,thead,tbody^[HTMLElement]|align,ch,chOff,vAlign',
|
||||
'template^[HTMLElement]|',
|
||||
'textarea^[HTMLElement]|autocapitalize,!autofocus,#cols,defaultValue,dirName,!disabled,#maxLength,#minLength,name,placeholder,!readOnly,!required,#rows,selectionDirection,#selectionEnd,#selectionStart,value,wrap',
|
||||
'title^[HTMLElement]|text',
|
||||
'track^[HTMLElement]|!default,kind,label,src,srclang',
|
||||
'ul^[HTMLElement]|!compact,type',
|
||||
'unknown^[HTMLElement]|',
|
||||
'video^media|#height,poster,#width',
|
||||
':svg:a^:svg:graphics|',
|
||||
':svg:animate^:svg:animation|',
|
||||
':svg:animateMotion^:svg:animation|',
|
||||
':svg:animateTransform^:svg:animation|',
|
||||
':svg:circle^:svg:geometry|',
|
||||
':svg:clipPath^:svg:graphics|',
|
||||
':svg:cursor^:svg:|',
|
||||
':svg:defs^:svg:graphics|',
|
||||
':svg:desc^:svg:|',
|
||||
':svg:discard^:svg:|',
|
||||
':svg:ellipse^:svg:geometry|',
|
||||
':svg:feBlend^:svg:|',
|
||||
':svg:feColorMatrix^:svg:|',
|
||||
':svg:feComponentTransfer^:svg:|',
|
||||
':svg:feComposite^:svg:|',
|
||||
':svg:feConvolveMatrix^:svg:|',
|
||||
':svg:feDiffuseLighting^:svg:|',
|
||||
':svg:feDisplacementMap^:svg:|',
|
||||
':svg:feDistantLight^:svg:|',
|
||||
':svg:feDropShadow^:svg:|',
|
||||
':svg:feFlood^:svg:|',
|
||||
':svg:feFuncA^:svg:componentTransferFunction|',
|
||||
':svg:feFuncB^:svg:componentTransferFunction|',
|
||||
':svg:feFuncG^:svg:componentTransferFunction|',
|
||||
':svg:feFuncR^:svg:componentTransferFunction|',
|
||||
':svg:feGaussianBlur^:svg:|',
|
||||
':svg:feImage^:svg:|',
|
||||
':svg:feMerge^:svg:|',
|
||||
':svg:feMergeNode^:svg:|',
|
||||
':svg:feMorphology^:svg:|',
|
||||
':svg:feOffset^:svg:|',
|
||||
':svg:fePointLight^:svg:|',
|
||||
':svg:feSpecularLighting^:svg:|',
|
||||
':svg:feSpotLight^:svg:|',
|
||||
':svg:feTile^:svg:|',
|
||||
':svg:feTurbulence^:svg:|',
|
||||
':svg:filter^:svg:|',
|
||||
':svg:foreignObject^:svg:graphics|',
|
||||
':svg:g^:svg:graphics|',
|
||||
':svg:image^:svg:graphics|',
|
||||
':svg:line^:svg:geometry|',
|
||||
':svg:linearGradient^:svg:gradient|',
|
||||
':svg:mpath^:svg:|',
|
||||
':svg:marker^:svg:|',
|
||||
':svg:mask^:svg:|',
|
||||
':svg:metadata^:svg:|',
|
||||
':svg:path^:svg:geometry|',
|
||||
':svg:pattern^:svg:|',
|
||||
':svg:polygon^:svg:geometry|',
|
||||
':svg:polyline^:svg:geometry|',
|
||||
':svg:radialGradient^:svg:gradient|',
|
||||
':svg:rect^:svg:geometry|',
|
||||
':svg:svg^:svg:graphics|#currentScale,#zoomAndPan',
|
||||
':svg:script^:svg:|type',
|
||||
':svg:set^:svg:animation|',
|
||||
':svg:stop^:svg:|',
|
||||
':svg:style^:svg:|!disabled,media,title,type',
|
||||
':svg:switch^:svg:graphics|',
|
||||
':svg:symbol^:svg:|',
|
||||
':svg:tspan^:svg:textPositioning|',
|
||||
':svg:text^:svg:textPositioning|',
|
||||
':svg:textPath^:svg:textContent|',
|
||||
':svg:title^:svg:|',
|
||||
':svg:use^:svg:graphics|',
|
||||
':svg:view^:svg:|#zoomAndPan',
|
||||
]);
|
||||
const SCHEMA:
|
||||
string[] =
|
||||
[
|
||||
'[Element]|textContent,%classList,className,id,innerHTML,*beforecopy,*beforecut,*beforepaste,*copy,*cut,*paste,*search,*selectstart,*webkitfullscreenchange,*webkitfullscreenerror,*wheel,outerHTML,#scrollLeft,#scrollTop',
|
||||
'[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',
|
||||
'media^[HTMLElement]|!autoplay,!controls,%crossOrigin,#currentTime,!defaultMuted,#defaultPlaybackRate,!disableRemotePlayback,!loop,!muted,*encrypted,#playbackRate,preload,src,%srcObject,#volume',
|
||||
':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:graphics^:svg:|',
|
||||
':svg:animation^:svg:|*begin,*end,*repeat',
|
||||
':svg:geometry^:svg:|',
|
||||
':svg:componentTransferFunction^:svg:|',
|
||||
':svg:gradient^:svg:|',
|
||||
':svg:textContent^:svg:graphics|',
|
||||
':svg:textPositioning^:svg:textContent|',
|
||||
'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',
|
||||
'area^[HTMLElement]|alt,coords,hash,host,hostname,href,!noHref,password,pathname,ping,port,protocol,referrerPolicy,search,shape,target,username',
|
||||
'audio^media|',
|
||||
'br^[HTMLElement]|clear',
|
||||
'base^[HTMLElement]|href,target',
|
||||
'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',
|
||||
'button^[HTMLElement]|!autofocus,!disabled,formAction,formEnctype,formMethod,!formNoValidate,formTarget,name,type,value',
|
||||
'canvas^[HTMLElement]|#height,#width',
|
||||
'content^[HTMLElement]|select',
|
||||
'dl^[HTMLElement]|!compact',
|
||||
'datalist^[HTMLElement]|',
|
||||
'details^[HTMLElement]|!open',
|
||||
'dialog^[HTMLElement]|!open,returnValue',
|
||||
'dir^[HTMLElement]|!compact',
|
||||
'div^[HTMLElement]|align',
|
||||
'embed^[HTMLElement]|align,height,name,src,type,width',
|
||||
'fieldset^[HTMLElement]|!disabled,name',
|
||||
'font^[HTMLElement]|color,face,size',
|
||||
'form^[HTMLElement]|acceptCharset,action,autocomplete,encoding,enctype,method,name,!noValidate,target',
|
||||
'frame^[HTMLElement]|frameBorder,longDesc,marginHeight,marginWidth,name,!noResize,scrolling,src',
|
||||
'frameset^[HTMLElement]|cols,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,rows',
|
||||
'hr^[HTMLElement]|align,color,!noShade,size,width',
|
||||
'head^[HTMLElement]|',
|
||||
'h1,h2,h3,h4,h5,h6^[HTMLElement]|align',
|
||||
'html^[HTMLElement]|version',
|
||||
'iframe^[HTMLElement]|align,!allowFullscreen,frameBorder,height,longDesc,marginHeight,marginWidth,name,referrerPolicy,%sandbox,scrolling,src,srcdoc,width',
|
||||
'img^[HTMLElement]|align,alt,border,%crossOrigin,#height,#hspace,!isMap,longDesc,lowsrc,name,referrerPolicy,sizes,src,srcset,useMap,#vspace,#width',
|
||||
'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',
|
||||
'keygen^[HTMLElement]|!autofocus,challenge,!disabled,keytype,name',
|
||||
'li^[HTMLElement]|type,#value',
|
||||
'label^[HTMLElement]|htmlFor',
|
||||
'legend^[HTMLElement]|align',
|
||||
'link^[HTMLElement]|as,charset,%crossOrigin,!disabled,href,hreflang,integrity,media,rel,%relList,rev,%sizes,target,type',
|
||||
'map^[HTMLElement]|name',
|
||||
'marquee^[HTMLElement]|behavior,bgColor,direction,height,#hspace,#loop,#scrollAmount,#scrollDelay,!trueSpeed,#vspace,width',
|
||||
'menu^[HTMLElement]|!compact',
|
||||
'meta^[HTMLElement]|content,httpEquiv,name,scheme',
|
||||
'meter^[HTMLElement]|#high,#low,#max,#min,#optimum,#value',
|
||||
'ins,del^[HTMLElement]|cite,dateTime',
|
||||
'ol^[HTMLElement]|!compact,!reversed,#start,type',
|
||||
'object^[HTMLElement]|align,archive,border,code,codeBase,codeType,data,!declare,height,#hspace,name,standby,type,useMap,#vspace,width',
|
||||
'optgroup^[HTMLElement]|!disabled,label',
|
||||
'option^[HTMLElement]|!defaultSelected,!disabled,label,!selected,text,value',
|
||||
'output^[HTMLElement]|defaultValue,%htmlFor,name,value',
|
||||
'p^[HTMLElement]|align',
|
||||
'param^[HTMLElement]|name,type,value,valueType',
|
||||
'picture^[HTMLElement]|',
|
||||
'pre^[HTMLElement]|#width',
|
||||
'progress^[HTMLElement]|#max,#value',
|
||||
'q,blockquote,cite^[HTMLElement]|',
|
||||
'script^[HTMLElement]|!async,charset,%crossOrigin,!defer,event,htmlFor,integrity,src,text,type',
|
||||
'select^[HTMLElement]|!autofocus,!disabled,#length,!multiple,name,!required,#selectedIndex,#size,value',
|
||||
'shadow^[HTMLElement]|',
|
||||
'source^[HTMLElement]|media,sizes,src,srcset,type',
|
||||
'span^[HTMLElement]|',
|
||||
'style^[HTMLElement]|!disabled,media,type',
|
||||
'caption^[HTMLElement]|align',
|
||||
'th,td^[HTMLElement]|abbr,align,axis,bgColor,ch,chOff,#colSpan,headers,height,!noWrap,#rowSpan,scope,vAlign,width',
|
||||
'col,colgroup^[HTMLElement]|align,ch,chOff,#span,vAlign,width',
|
||||
'table^[HTMLElement]|align,bgColor,border,%caption,cellPadding,cellSpacing,frame,rules,summary,%tFoot,%tHead,width',
|
||||
'tr^[HTMLElement]|align,bgColor,ch,chOff,vAlign',
|
||||
'tfoot,thead,tbody^[HTMLElement]|align,ch,chOff,vAlign',
|
||||
'template^[HTMLElement]|',
|
||||
'textarea^[HTMLElement]|autocapitalize,!autofocus,#cols,defaultValue,dirName,!disabled,#maxLength,#minLength,name,placeholder,!readOnly,!required,#rows,selectionDirection,#selectionEnd,#selectionStart,value,wrap',
|
||||
'title^[HTMLElement]|text',
|
||||
'track^[HTMLElement]|!default,kind,label,src,srclang',
|
||||
'ul^[HTMLElement]|!compact,type',
|
||||
'unknown^[HTMLElement]|',
|
||||
'video^media|#height,poster,#width',
|
||||
':svg:a^:svg:graphics|',
|
||||
':svg:animate^:svg:animation|',
|
||||
':svg:animateMotion^:svg:animation|',
|
||||
':svg:animateTransform^:svg:animation|',
|
||||
':svg:circle^:svg:geometry|',
|
||||
':svg:clipPath^:svg:graphics|',
|
||||
':svg:cursor^:svg:|',
|
||||
':svg:defs^:svg:graphics|',
|
||||
':svg:desc^:svg:|',
|
||||
':svg:discard^:svg:|',
|
||||
':svg:ellipse^:svg:geometry|',
|
||||
':svg:feBlend^:svg:|',
|
||||
':svg:feColorMatrix^:svg:|',
|
||||
':svg:feComponentTransfer^:svg:|',
|
||||
':svg:feComposite^:svg:|',
|
||||
':svg:feConvolveMatrix^:svg:|',
|
||||
':svg:feDiffuseLighting^:svg:|',
|
||||
':svg:feDisplacementMap^:svg:|',
|
||||
':svg:feDistantLight^:svg:|',
|
||||
':svg:feDropShadow^:svg:|',
|
||||
':svg:feFlood^:svg:|',
|
||||
':svg:feFuncA^:svg:componentTransferFunction|',
|
||||
':svg:feFuncB^:svg:componentTransferFunction|',
|
||||
':svg:feFuncG^:svg:componentTransferFunction|',
|
||||
':svg:feFuncR^:svg:componentTransferFunction|',
|
||||
':svg:feGaussianBlur^:svg:|',
|
||||
':svg:feImage^:svg:|',
|
||||
':svg:feMerge^:svg:|',
|
||||
':svg:feMergeNode^:svg:|',
|
||||
':svg:feMorphology^:svg:|',
|
||||
':svg:feOffset^:svg:|',
|
||||
':svg:fePointLight^:svg:|',
|
||||
':svg:feSpecularLighting^:svg:|',
|
||||
':svg:feSpotLight^:svg:|',
|
||||
':svg:feTile^:svg:|',
|
||||
':svg:feTurbulence^:svg:|',
|
||||
':svg:filter^:svg:|',
|
||||
':svg:foreignObject^:svg:graphics|',
|
||||
':svg:g^:svg:graphics|',
|
||||
':svg:image^:svg:graphics|',
|
||||
':svg:line^:svg:geometry|',
|
||||
':svg:linearGradient^:svg:gradient|',
|
||||
':svg:mpath^:svg:|',
|
||||
':svg:marker^:svg:|',
|
||||
':svg:mask^:svg:|',
|
||||
':svg:metadata^:svg:|',
|
||||
':svg:path^:svg:geometry|',
|
||||
':svg:pattern^:svg:|',
|
||||
':svg:polygon^:svg:geometry|',
|
||||
':svg:polyline^:svg:geometry|',
|
||||
':svg:radialGradient^:svg:gradient|',
|
||||
':svg:rect^:svg:geometry|',
|
||||
':svg:svg^:svg:graphics|#currentScale,#zoomAndPan',
|
||||
':svg:script^:svg:|type',
|
||||
':svg:set^:svg:animation|',
|
||||
':svg:stop^:svg:|',
|
||||
':svg:style^:svg:|!disabled,media,title,type',
|
||||
':svg:switch^:svg:graphics|',
|
||||
':svg:symbol^:svg:|',
|
||||
':svg:tspan^:svg:textPositioning|',
|
||||
':svg:text^:svg:textPositioning|',
|
||||
':svg:textPath^:svg:textContent|',
|
||||
':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} = {
|
||||
'class': 'className',
|
||||
'formaction': 'formAction',
|
||||
'innerHtml': 'innerHTML',
|
||||
'readonly': 'readOnly',
|
||||
'tabindex': 'tabIndex'
|
||||
'tabindex': 'tabIndex',
|
||||
};
|
||||
|
||||
@Injectable()
|
||||
|
|
|
@ -31,6 +31,14 @@ export function main() {
|
|||
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', () => {
|
||||
expect(registry.hasProperty('div', 'id', [])).toBeTruthy();
|
||||
expect(registry.hasProperty('div', 'title', [])).toBeTruthy();
|
||||
|
@ -46,6 +54,16 @@ export function main() {
|
|||
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', () => {
|
||||
// inheritance: video => media => [HTMLElement] => [Element]
|
||||
expect(registry.hasProperty('video', 'className', [])).toBeTruthy(); // from [Element]
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {MapWrapper} from '../../src/facade/collection';
|
||||
|
||||
const SVG_PREFIX = ':svg:';
|
||||
|
||||
// Element | Node interfaces
|
||||
|
@ -17,7 +19,24 @@ const ELEMENT_IF = '[Element]';
|
|||
const HTMLELEMENT_IF = '[HTMLElement]';
|
||||
|
||||
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 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]); });
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
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(
|
||||
visited: {[name: string]: boolean}, descMap: Map<string, string[]>, type: Function): string {
|
||||
const name = extractName(type);
|
||||
|
|
Loading…
Reference in New Issue