-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function properties (e.g. vs element keys) #268
Comments
[1] items post constructor: here's chrome with no extensions - this is NOT the case with gecko more to follow |
groups
I think most of this is just equivalency of engine and version - but some things are definitely behind prefs/flags
So that said
[1] e.g. let htmlList = {
// ... etc
HTMLAreaElement: HTMLAreaElement.prototype,
HTMLDialogElement: undefined, // FF98+ HTMLDialogElement.prototype,
}
try {
if (HTMLDialogElement.prototype !== undefined) {
htmlList["HTMLDialogElement"] = HTMLDialogElement.prototype
}
} catch(e) {} more to follow |
So I'm trying to understand htmlelement keys vs HTML*Element keys, so I did a diff, using FF122 Nightly (using TZP not creepy's result). I combined all the values into a single array, deduped it, removed constructor // HTML*Elements: 447
let aPOC = ['ERROR','HAVE_CURRENT_DATA','HAVE_ENOUGH_DATA','HAVE_FUTURE_DATA','HAVE_METADATA','HAVE_NOTHING','LOADED','LOADING','NETWORK_EMPTY','NETWORK_IDLE','NETWORK_LOADING','NETWORK_NO_SOURCE','NONE','aLink','abbr','accept','acceptCharset','accessKey','accessKeyLabel','action','add','addTextTrack','align','allow','allowFullscreen','allowedToPlay','alt','archive','areas','as','async','attachInternals','autocapitalize','autocomplete','autofocus','autoplay','axis','background','bgColor','blur','border','buffered','canPlayType','caption','captureStream','cellIndex','cellPadding','cellSpacing','cells','ch','chOff','charset','checkValidity','checked','cite','clear','click','close','code','codeBase','codeType','colSpan','color','cols','compact','complete','content','contentDocument','contentEditable','contentWindow','control','controls','coords','createCaption','createTBody','createTFoot','createTHead','crossOrigin','currentSrc','currentTime','data','dataset','dateTime','declare','decode','decoding','default','defaultChecked','defaultMuted','defaultPlaybackRate','defaultSelected','defaultValue','defer','deleteCaption','deleteCell','deleteRow','deleteTFoot','deleteTHead','dir','dirName','disablePictureInPicture','disabled','download','draggable','duration','elements','encoding','enctype','ended','enterKeyHint','error','event','fastSeek','files','focus','form','formAction','formEnctype','formMethod','formNoValidate','formTarget','frame','frameBorder','getContext','getSVGDocument','getVideoPlaybackQuality','hash','headers','height','hidden','hidePopover','high','host','hostname','href','hreflang','hspace','htmlFor','httpEquiv','imageSizes','imageSrcset','indeterminate','index','inert','innerText','inputMode','insertCell','insertRow','integrity','isContentEditable','isMap','item','kind','label','labels','lang','length','link','list','load','loading','longDesc','loop','low','lowsrc','marginHeight','marginWidth','max','maxLength','media','mediaKeys','method','min','minLength','mozAudioCaptured','mozCaptureStream','mozCaptureStreamUntilEnded','mozDecodedFrames','mozFragmentEnd','mozFrameDelay','mozGetMetadata','mozHasAudio','mozIsTextField','mozOpaque','mozPaintedFrames','mozParsedFrames','mozPresentedFrames','mozPrintCallback','multiple','muted','name','namedItem','naturalHeight','naturalWidth','networkState','noHref','noModule','noResize','noShade','noValidate','noWrap','nonce','offsetHeight','offsetLeft','offsetParent','offsetTop','offsetWidth','onabort','onafterprint','onanimationcancel','onanimationend','onanimationiteration','onanimationstart','onauxclick','onbeforeinput','onbeforeprint','onbeforetoggle','onbeforeunload','onblur','oncancel','oncanplay','oncanplaythrough','onchange','onclick','onclose','oncontextmenu','oncopy','oncuechange','oncut','ondblclick','ondrag','ondragend','ondragenter','ondragleave','ondragover','ondragstart','ondrop','ondurationchange','onemptied','onencrypted','onended','onerror','onfocus','onformdata','ongamepadconnected','ongamepaddisconnected','ongotpointercapture','onhashchange','oninput','oninvalid','onkeydown','onkeypress','onkeyup','onlanguagechange','onload','onloadeddata','onloadedmetadata','onloadstart','onlostpointercapture','onmessage','onmessageerror','onmousedown','onmouseenter','onmouseleave','onmousemove','onmouseout','onmouseover','onmouseup','onmozfullscreenchange','onmozfullscreenerror','onoffline','ononline','onpagehide','onpageshow','onpaste','onpause','onplay','onplaying','onpointercancel','onpointerdown','onpointerenter','onpointerleave','onpointermove','onpointerout','onpointerover','onpointerup','onpopstate','onprogress','onratechange','onrejectionhandled','onreset','onresize','onscroll','onscrollend','onsecuritypolicyviolation','onseeked','onseeking','onselect','onselectionchange','onselectstart','onslotchange','onstalled','onstorage','onsubmit','onsuspend','ontimeupdate','ontoggle','ontransitioncancel','ontransitionend','ontransitionrun','ontransitionstart','onunhandledrejection','onunload','onvolumechange','onwaiting','onwaitingforkey','onwebkitanimationend','onwebkitanimationiteration','onwebkitanimationstart','onwebkittransitionend','onwheel','open','optimum','options','origin','outerText','password','pathname','pattern','pause','paused','ping','placeholder','play','playbackRate','played','popover','popoverTargetAction','popoverTargetElement','port','position','poster','preload','preservesPitch','protocol','readOnly','readyState','referrerPolicy','rel','relList','remove','reportValidity','requestSubmit','required','reset','returnValue','rev','reversed','rowIndex','rowSpan','rows','rules','sandbox','scheme','scope','scrolling','search','sectionRowIndex','seekToNextFrame','seekable','seeking','select','selected','selectedIndex','selectedOptions','selectionDirection','selectionEnd','selectionStart','setCustomValidity','setMediaKeys','setRangeText','setSelectionRange','setSinkId','shadowRootDelegatesFocus','shadowRootMode','shape','sheet','show','showModal','showPicker','showPopover','sinkId','size','sizes','span','spellcheck','src','srcObject','srcdoc','srclang','srcset','standby','start','step','stepDown','stepUp','style','submit','summary','tBodies','tFoot','tHead','tabIndex','target','text','textLength','textTracks','title','toBlob','toDataURL','toString','togglePopover','track','transferControlToOffscreen','translate','type','useMap','username','vAlign','vLink','validationMessage','validity','value','valueAsDate','valueAsNumber','version','videoHeight','videoWidth','volume','vspace','webkitEntries','webkitdirectory','width','willValidate','wrap','x','y']
// HTMLElement TZP: 312
let aTZP = ['ATTRIBUTE_NODE','CDATA_SECTION_NODE','COMMENT_NODE','DOCUMENT_FRAGMENT_NODE','DOCUMENT_NODE','DOCUMENT_POSITION_CONTAINED_BY','DOCUMENT_POSITION_CONTAINS','DOCUMENT_POSITION_DISCONNECTED','DOCUMENT_POSITION_FOLLOWING','DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC','DOCUMENT_POSITION_PRECEDING','DOCUMENT_TYPE_NODE','ELEMENT_NODE','ENTITY_NODE','ENTITY_REFERENCE_NODE','NOTATION_NODE','PROCESSING_INSTRUCTION_NODE','TEXT_NODE','accessKey','accessKeyLabel','addEventListener','after','align','animate','append','appendChild','ariaAtomic','ariaAutoComplete','ariaBusy','ariaChecked','ariaColCount','ariaColIndex','ariaColIndexText','ariaColSpan','ariaCurrent','ariaDescription','ariaDisabled','ariaExpanded','ariaHasPopup','ariaHidden','ariaInvalid','ariaKeyShortcuts','ariaLabel','ariaLevel','ariaLive','ariaModal','ariaMultiLine','ariaMultiSelectable','ariaOrientation','ariaPlaceholder','ariaPosInSet','ariaPressed','ariaReadOnly','ariaRelevant','ariaRequired','ariaRoleDescription','ariaRowCount','ariaRowIndex','ariaRowIndexText','ariaRowSpan','ariaSelected','ariaSetSize','ariaSort','ariaValueMax','ariaValueMin','ariaValueNow','ariaValueText','assignedSlot','attachInternals','attachShadow','attributes','autocapitalize','autofocus','baseURI','before','blur','checkVisibility','childElementCount','childNodes','children','classList','className','click','clientHeight','clientLeft','clientTop','clientWidth','cloneNode','closest','compareDocumentPosition','contains','contentEditable','convertPointFromNode','convertQuadFromNode','convertRectFromNode','dataset','dir','dispatchEvent','draggable','enterKeyHint','firstChild','firstElementChild','focus','getAnimations','getAttribute','getAttributeNS','getAttributeNames','getAttributeNode','getAttributeNodeNS','getBoundingClientRect','getBoxQuads','getClientRects','getElementsByClassName','getElementsByTagName','getElementsByTagNameNS','getRootNode','hasAttribute','hasAttributeNS','hasAttributes','hasChildNodes','hasPointerCapture','hidden','hidePopover','id','inert','innerHTML','innerText','inputMode','insertAdjacentElement','insertAdjacentHTML','insertAdjacentText','insertBefore','isConnected','isContentEditable','isDefaultNamespace','isEqualNode','isSameNode','lang','lastChild','lastElementChild','localName','lookupNamespaceURI','lookupPrefix','matches','mozMatchesSelector','mozRequestFullScreen','namespaceURI','nextElementSibling','nextSibling','nodeName','nodeType','nodeValue','nonce','normalize','offsetHeight','offsetLeft','offsetParent','offsetTop','offsetWidth','onabort','onanimationcancel','onanimationend','onanimationiteration','onanimationstart','onauxclick','onbeforeinput','onbeforetoggle','onblur','oncancel','oncanplay','oncanplaythrough','onchange','onclick','onclose','oncontextmenu','oncopy','oncuechange','oncut','ondblclick','ondrag','ondragend','ondragenter','ondragleave','ondragover','ondragstart','ondrop','ondurationchange','onemptied','onended','onerror','onfocus','onformdata','onfullscreenchange','onfullscreenerror','ongotpointercapture','oninput','oninvalid','onkeydown','onkeypress','onkeyup','onload','onloadeddata','onloadedmetadata','onloadstart','onlostpointercapture','onmousedown','onmouseenter','onmouseleave','onmousemove','onmouseout','onmouseover','onmouseup','onmozfullscreenchange','onmozfullscreenerror','onpaste','onpause','onplay','onplaying','onpointercancel','onpointerdown','onpointerenter','onpointerleave','onpointermove','onpointerout','onpointerover','onpointerup','onprogress','onratechange','onreset','onresize','onscroll','onscrollend','onsecuritypolicyviolation','onseeked','onseeking','onselect','onselectionchange','onselectstart','onslotchange','onstalled','onsubmit','onsuspend','ontimeupdate','ontoggle','ontransitioncancel','ontransitionend','ontransitionrun','ontransitionstart','onvolumechange','onwaiting','onwebkitanimationend','onwebkitanimationiteration','onwebkitanimationstart','onwebkittransitionend','onwheel','outerHTML','outerText','ownerDocument','parentElement','parentNode','part','popover','prefix','prepend','previousElementSibling','previousSibling','querySelector','querySelectorAll','releaseCapture','releasePointerCapture','remove','removeAttribute','removeAttributeNS','removeAttributeNode','removeChild','removeEventListener','replaceChild','replaceChildren','replaceWith','requestFullscreen','requestPointerLock','role','scroll','scrollBy','scrollHeight','scrollIntoView','scrollLeft','scrollLeftMax','scrollTo','scrollTop','scrollTopMax','scrollWidth','setAttribute','setAttributeNS','setAttributeNode','setAttributeNodeNS','setCapture','setHTMLUnsafe','setPointerCapture','shadowRoot','showPopover','slot','spellcheck','style','tabIndex','tagName','textContent','title','toggleAttribute','togglePopover','translate','webkitMatchesSelector']
let onlyTZP = aTZP.filter(x => !aPOC.includes(x))
let onlyPOC = aPOC.filter(x => !aTZP.includes(x))
let aCommon = aPOC.filter(x => aTZP.includes(x))
console.log("onlyTZP", onlyTZP.length+"\n", "['"+ onlyTZP.join("','") +"']" )
console.log("onlyPOC", onlyPOC.length+"\n", "['"+ onlyPOC.join("','") +"']" )
console.log("aCommon", aCommon.length+"\n", "['"+ aCommon.join("','") +"']" ) results
|
and then there's canvas element and svg*elements .. what else? which I could add to canvas/svg sections, except in the past I decided to not bother with canvas because it was equivalency edit: OK: I can programmatically check from an array of strings by checking and I might call this |
OK, did a revamp of groups (was 4 now 5), and I now pass an array of strings, so we can programmatically detect when a window property is not supported note: not that I expected any diffs
here's some notes: re gecko
|
html poc<html>
<head><title>element keys</title><style>.mono {font-family: monospace;}</style></head><body>
<br><div class="mono" id="results"></div>
<script>
'use strict';
let oHash = {}
let oData = {}
function mini(str) {
// https://stackoverflow.com/a/22429679
const json = `${JSON.stringify(str)}`
let i, len, hash = 0x811c9dc5
for (i = 0, len = json.length; i < len; i++) {
hash = Math.imul(31, hash) + json.charCodeAt(i) | 0
}
return ('0000000' + (hash >>> 0).toString(16)).slice(-8)
}
//https://w3c.github.io/elements-of-html/
// ignore: checked in gecko + blink (desktop)
let ignore = [
'caption','h1','h2','h3','h4','h5','h6','p', // = div
'ins', // = del
'xmp', // = pre
'colgroup', // = col
'dl','menu', // = dir
'q', // = blockquote
'tfoot','thead', // = tbody
// = span
'abbr','acronym','address','applet','article','aside','b',
'basefont','bdi','bdo','big','center','cite','code','dd','dfn','dt','em',
'figcaption','figure','footer','head','header','hgroup','i','isindex',
'kbd','keygen','main','mark','menuitem','nav','nextid','noframes','noscript',
'picture','plaintext','rb','rbc','rp','rt','rtc','ruby','s','samp','section',
'small','span','strike','strong','sub','summary','sup','tt','u','var','wbr',
// input types = input
'input|button','input|checkbox','input|color','input|date','input|datetime',
'input|datetime-local','input|file','input|image','input|month','input|number',
'input|password','input|radio','input|range','input|reset','input|search',
'input|submit','input|tel','input|text','input|time','input|url','input|week',
]
let elements = [
'a','area','audio',
'base','blockquote','body','br','button',
'canvas','col',
'data','datalist','del','details','dialog','dir','div',
'embed',
'fieldset','font','form','frame','frameset',
'hr','html',
'iframe','img','input',
'label','legend','li','link',
'map','meta','meter',
'object','ol','optgroup','option','output',
'param','pre','progress',
'script','select','source','style',
'table','tbody','td','template','textarea','th','time','title','tr','track',
'ul','video',
]
elements.sort() // why not
console.log("'"+ elements.join("','")+"'")
let aEverything = []
try {
elements.forEach(function(el) {
let item = el.split("|")[0]
let type = el.split("|")[1]
try {
const id = "target"+el
const element = document.createElement(item)
element.setAttribute("id", id)
document.body.appendChild(element)
if (type !== undefined) {
document.getElementById(id).type = type
}
const htmlElement = document.getElementById(id)
let keys = []
for (const key in htmlElement) {keys.push(key)}
keys.forEach(function(j) {
aEverything.push(j)
})
try {document.getElementById(id).remove()} catch(e) {}
let hash = mini(keys)
if (oHash[hash] == undefined) {
oHash[hash] = {"count": keys.length, "data": []}
oData[hash] = "['"+ keys.join("', '") +"']"
}
oHash[hash]["data"].push(el)
} catch(e) {
oHash.push(item +" "+ e.name)
}
})
let display = []
display.push("<u><b>RESULTS</b></u><br>")
for (const k of Object.keys(oData).sort()) {
display.push(k +" ["+ oHash[k].count +"]: "+ oHash[k]["data"].join(", ")
+ "<br><details>"+ oData[k] +"</details>"
)
}
document.getElementById("results").innerHTML = display.join("<br>")
//* everything
//console.log(aEverything) // 815 all : 749 (no constructors)
aEverything.sort() // order is artifical due to htmlList so lets remove that here
aEverything = aEverything.filter(function(item, position) {return aEverything.indexOf(item) === position}) // deduped
let aPOC = aEverything.filter(x => !["constructor"].includes(x)) // remove constructor
console.log("EVERYTHING: " + mini(aEverything) +" ["+ aEverything.length +"]\n", "'"+ aPOC.join("','") +"'")
//EVERYTHING: d6d0fc0e [630]
//*/
} catch (e) {
document.getElementById("results").innerHTML = e+""
}
</script></body></html> I tested a larger set of elements, but removed those that duplicated hashes - the results of duplication were the same in blink + gecko results (minus the detail data)
this was on FF122 nightly ... combined I get 630 unique keys |
so I think we could expand the creepy/tzp "html element keys" test - because currently it's not that, it's a "div element" keys test then we have HTLM*Element tests in my PoC, which can be expanded to include other window items Is one test duplicitous of the other? I should see if I can get my PoC to 630 unique values (i.e start adding in the problem them becomes in the elements section I would have two |
anyway - moved the test to https://arkenfox.github.io/TZP/tests/functionprops.html - because we're enumerating properties on functions - and I started adding items in lists, so you can run |
Nice. We could also query elements on the page and see if anything was added or removed or re-ordered. scriptElems = [...document.querySelectorAll('script')].map((el) => el.attributes)
document.querySelectorAll('body *') // Everything. Probably too much
document.querySelectorAll('body > *') // The main skeleton |
hah ... this is FF with JShelter relevant prototypeLies courtesy of creepy
looks like I scored higher!!! nah nah nah nah .. |
well, actually .. not ... I'm not ... I just picked up some things you didn't because I check a few more functions. And I miss some stuff e.g. in Analyser.Node - I guess that's because I'm not checking "sub-functions" of function properties .. etc |
. |
FYI: @abrahamjuliot
htmlelement keys as per TZP (and creepy)
HTML*Element keys - see https://arkenfox.github.io/TZP/tests/htmlelements.html
more to follow
The text was updated successfully, but these errors were encountered: