-
Notifications
You must be signed in to change notification settings - Fork 33
Sanitizer built-ins document #244
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f499f7d
Initial draft.
otherdaniel 4ff9fd5
Add attributes
otherdaniel 94a6ef7
Rework attributes. More standards references.
otherdaniel c2f6465
Complete ARIA attributes.
otherdaniel 8ba0ee6
Review feedback.
otherdaniel 48aebd1
Try empty -json file to fix preview.
otherdaniel 2ea2510
Review feedback: Reference event content handlers; add remove elements
otherdaniel d84fe5f
Fix pr-push-yml
otherdaniel 74bfa58
Fix pr-push-yml even harder.
otherdaniel 4f94295
Turn note into warning/advisement.
otherdaniel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| /.project | ||
| /out | ||
| /*.ninja* | ||
| /builtins/safe-default-configuration.json | ||
| /builtins/safe-baseline-configuration-materialized.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| // https://html.spec.whatwg.org/#ix-event-handlers | ||
| onafterprint | ||
| onauxclick | ||
| onbeforeinput | ||
| onbeforematch | ||
| onbeforeprint | ||
| onbeforeunload | ||
| onbeforetoggle | ||
| onblur | ||
| oncancel | ||
| oncanplay | ||
| oncanplaythrough | ||
| onchange | ||
| onclick | ||
| onclose | ||
| oncontextlost | ||
| oncontextmenu | ||
| oncontextrestored | ||
| oncopy | ||
| oncuechange | ||
| oncut | ||
| ondblclick | ||
| ondrag | ||
| ondragend | ||
| ondragenter | ||
| ondragleave | ||
| ondragover | ||
| ondragstart | ||
| ondrop | ||
| ondurationchange | ||
| onemptied | ||
| onended | ||
| onerror | ||
| onfocus | ||
| onformdata | ||
| onhashchange | ||
| oninput | ||
| oninvalid | ||
| onkeydown | ||
| onkeypress | ||
| onkeyup | ||
| onlanguagechange | ||
| onload | ||
| onloadeddata | ||
| onloadedmetadata | ||
| onloadstart | ||
| onmessage | ||
| onmessageerror | ||
| onmousedown | ||
| onmouseenter | ||
| onmouseleave | ||
| onmousemove | ||
| onmouseout | ||
| onmouseover | ||
| onmouseup | ||
| onoffline | ||
| ononline | ||
| onpagehide | ||
| onpagereveal | ||
| onpageshow | ||
| onpageswap | ||
| onpaste | ||
| onpause | ||
| onplay | ||
| onplaying | ||
| onpopstate | ||
| onprogress | ||
| onratechange | ||
| onreset | ||
| onresize | ||
| onrejectionhandled | ||
| onscroll | ||
| onscrollend | ||
| onsecuritypolicyviolation | ||
| onseeked | ||
| onseeking | ||
| onselect | ||
| onslotchange | ||
| onstalled | ||
| onstorage | ||
| onsubmit | ||
| onsuspend | ||
| ontimeupdate | ||
| ontoggle | ||
| onunhandledrejection | ||
| onunload | ||
| onvolumechange | ||
| onwaiting | ||
| onwheel |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| "removeElements": [ | ||
| { | ||
| "namespace": "http://www.w3.org/1999/xhtml", | ||
| "name": "script" | ||
| }, | ||
| { | ||
| "namespace": "http://www.w3.org/1999/xhtml", | ||
| "name": "frame" | ||
| }, | ||
| { | ||
| "namespace": "http://www.w3.org/1999/xhtml", | ||
| "name": "iframe" | ||
| }, | ||
| { | ||
| "namespace": "http://www.w3.org/1999/xhtml", | ||
| "name": "object" | ||
| }, | ||
| { | ||
| "namespace": "http://www.w3.org/1999/xhtml", | ||
| "name": "embed" | ||
| }, | ||
| { | ||
| "namespace": "http://www.w3.org/2000/svg", | ||
| "name": "script" | ||
| }, | ||
| { | ||
| "namespace": "http://www.w3.org/2000/svg", | ||
| "name": "use" | ||
| } | ||
| ], | ||
| "removeAttributes": [] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Sanitizer API - Build configuration dictionary from text file. | ||
|
|
||
| import json | ||
| import argparse | ||
| import sys | ||
|
|
||
| def main(): | ||
| parser = argparse.ArgumentParser() | ||
| parser.add_argument("--input", type=argparse.FileType('r'), required=True) | ||
| parser.add_argument("--event-handlers", type=argparse.FileType('r'), | ||
| required=True) | ||
| parser.add_argument("--out", type=argparse.FileType('w'), required=True) | ||
| args = parser.parse_args() | ||
|
|
||
| try: | ||
| config = json.load(args.input) | ||
| except BaseException as err: | ||
| parser.error("Cannot read from --input file.") | ||
|
|
||
| try: | ||
| events = args.event_handlers.read() | ||
| except BaseException as err: | ||
| parser.error("Cannot read from --event-handlers file.") | ||
|
|
||
| for event in events.split("\n"): | ||
| if not event: | ||
| continue | ||
| if event.startswith("//"): | ||
| continue | ||
| config["removeAttributes"].append(event) | ||
|
|
||
| try: | ||
| json.dump(config, args.out, indent=2) | ||
| except BaseException as err: | ||
| parser.error("Cannot write to --out file.") | ||
| return 0 | ||
|
|
||
| if __name__ == "__main__": | ||
| main() |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # Sanitizer API - Build configuration dictionary from text file. | ||
|
|
||
| import json | ||
| import argparse | ||
| import sys | ||
|
|
||
| def main(): | ||
| parser = argparse.ArgumentParser() | ||
| parser.add_argument("--input", type=argparse.FileType('r'), required=True) | ||
| parser.add_argument("--out", type=argparse.FileType('w'), required=True) | ||
| args = parser.parse_args() | ||
|
|
||
| try: | ||
| lines = args.input.read() | ||
| except BaseException as err: | ||
| parser.error("Cannot read from --input file.") | ||
|
|
||
| result = { "elements": [], "attributes": [] } | ||
| current = [] | ||
| for line in lines.split("\n"): | ||
| if not line: | ||
| pass | ||
| elif line.startswith("//"): | ||
| pass | ||
| elif line.startswith("- "): | ||
| current.append({ "name": line[2:], "namespace": None }) | ||
| elif line == "[HTML Global]": | ||
| current = result["attributes"] | ||
| else: | ||
| elem = { "name": line, "namespace": "http://www.w3.org/1999/xhtml", | ||
| "attributes": [] } | ||
| result["elements"].append(elem) | ||
| current = elem["attributes"] | ||
|
|
||
| try: | ||
| json.dump(result, args.out, indent=2) | ||
| except BaseException as err: | ||
| parser.error("Cannot write to --out file.") | ||
| return 0 | ||
|
|
||
| if __name__ == "__main__": | ||
| main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| // Document element | ||
| // https://html.spec.whatwg.org/#the-root-element | ||
|
|
||
| html | ||
|
|
||
| // Document metadata | ||
| // https://html.spec.whatwg.org/#document-metadata | ||
|
|
||
| head | ||
| title | ||
|
|
||
| // meta and link, purposely omitted | ||
|
|
||
| // Sections | ||
| // https://html.spec.whatwg.org/#sections | ||
|
|
||
| body | ||
| article | ||
| section | ||
| nav | ||
| aside | ||
| h1 | ||
| h2 | ||
| h3 | ||
| h4 | ||
| h5 | ||
| h6 | ||
| hgroup | ||
| header | ||
| footer | ||
| address | ||
|
|
||
| // Grouping Content | ||
| // https://html.spec.whatwg.org/#grouping-content | ||
|
|
||
| p | ||
| hr | ||
| pre | ||
| blockquote | ||
| - cite | ||
| ol | ||
| - reversed | ||
| - start | ||
| - type | ||
| ul | ||
| menu | ||
| li | ||
| - value | ||
| dl | ||
| dt | ||
| dd | ||
| figure | ||
| figcaption | ||
| main | ||
| search | ||
| div | ||
|
|
||
| // Text-level Semantics | ||
| // https://html.spec.whatwg.org/#text-level-semantics ### | ||
|
|
||
| a | ||
| - href | ||
| - rel | ||
| - hreflang | ||
| - type | ||
| // Purposely omitted: | ||
| // - target | ||
| // - download | ||
| // - referrerpolicy | ||
| // - ping | ||
| em | ||
| strong | ||
| small | ||
| s | ||
| cite | ||
| q | ||
| dfn | ||
| - title | ||
| abbr | ||
| - title | ||
| ruby | ||
| rt | ||
| rp | ||
| data | ||
| - value | ||
| time | ||
| - datetime | ||
| code | ||
| var | ||
| samp | ||
| kbd | ||
| sub | ||
| sup | ||
| i | ||
| b | ||
| u | ||
| mark | ||
| bdi | ||
| - dir | ||
| bdo | ||
| - dir | ||
| span | ||
| br | ||
| wbr | ||
|
|
||
| // Edits | ||
| // https://html.spec.whatwg.org/#edits | ||
|
|
||
| ins | ||
| - cite | ||
| - datetime | ||
| del | ||
| - cite | ||
| - datetime | ||
|
|
||
| // Embedded content | ||
| // https://html.spec.whatwg.org/#embedded-content | ||
| // | ||
| // Purposely omitted. | ||
|
|
||
| // Tabular Data | ||
| // https://html.spec.whatwg.org/#tables | ||
|
|
||
| table | ||
| caption | ||
| colgroup | ||
| - span | ||
| col | ||
| - span | ||
| tbody | ||
| thead | ||
| tfoot | ||
| tr | ||
| td | ||
| - colspan | ||
| - rowspan | ||
| - headers | ||
| th | ||
| - colspan | ||
| - rowspan | ||
| - headers | ||
| - scope | ||
| - abbr | ||
|
|
||
| // Forms | ||
| // https://html.spec.whatwg.org/#forms | ||
| // | ||
| // Purposely omitted | ||
|
|
||
| // Interactive Elements | ||
| // https://html.spec.whatwg.org/#interactive-elements | ||
| // | ||
| // Purposly omitted. | ||
|
|
||
| // Scripting | ||
| // https://html.spec.whatwg.org/#scripting | ||
| // | ||
| // Purposely omitted. | ||
|
|
||
| // SVG: TBD | ||
| // MathML: TDB | ||
|
|
||
| // HTML global attributes | ||
| // | ||
| // Selection of attributes. Most are purposely omitted. | ||
|
|
||
| [HTML Global] | ||
| - dir | ||
| - lang | ||
| - title | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.