Skip to content

Commit

Permalink
Remove otherMarkup
Browse files Browse the repository at this point in the history
  • Loading branch information
otherdaniel committed Sep 18, 2024
1 parent d86d83b commit 764d394
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ interface Sanitizer {
undefined removeAttribute(SanitizerAttribute attribute);
undefined setComment(boolean allow);
undefined setDataAttributes(boolean allow);
undefined setOtherMarkup(boolean allow);

// Remove markup that executes script. May modify multiple lists:
undefined removeUnsafe();
Expand All @@ -264,9 +263,16 @@ ISSUE(238): Final naming TBD.

ISSUE(240): "other markup" TBD.

ISSUE: Can a missing dict value and a dict entry with an empty sequence be
treated differently?

ISSUE: Should these be setter methods -- particularly the setXXX(boolean) --
or setters or properties or somesuch?

ISSUE: Should the modifier methods return a reference to [=this=], so that you
can 'chain' methods?
(e.g. `sanitizer.allowElement("a").allowElement("span")`).

<div algorithm>
The <dfn for="Sanitizer" export>constructor</dfn>(|config|)
method steps are:
Expand Down Expand Up @@ -354,13 +360,6 @@ The <dfn for="Sanitizer" export>setDataAttributes</dfn>(|allow|) method steps ar

</div>

<div algorithm>
The <dfn for="Sanitizer" export>setOtherMarkup</dfn>(|allow|) method steps are:

1. Set [=this=]'s [=internal slot=]'s {{SanitizerConfig/otherMarkup}} to |allow|.

</div>

<div algorithm>
The <dfn for="Sanitizer" export>removeUnsafe</dfn>() method steps are:

Expand Down Expand Up @@ -402,10 +401,10 @@ dictionary SanitizerConfig {

boolean comments;
boolean dataAttributes;
boolean otherMarkup;
};
</pre>

ISSUE: Sould members be required, or have declared defaults?

# Algorithms # {#algorithms}

Expand Down Expand Up @@ -480,7 +479,7 @@ template contents). It consistes of these steps:
1. else:
1. Let |elementName| be a {{SanitizerElementNamespace}} with |child|'s
[=Element/local name=] and [=Element/namespace=].
1. If |config|["{{SanitizerConfig/removeElements}}"] [=SanitizerConfig/contains=] |elementName|, or if |config|["{{SanitizerConfig/elements}}"] does not [=SanitizerConfig/contain=] |elementName| and |config|["{{SanitizerConfig/otherMarkup}}"] is false:
1. If |config|["{{SanitizerConfig/removeElements}}"] [=SanitizerConfig/contains=] |elementName|, or if |config|["{{SanitizerConfig/elements}}"] is not [=list/empty=] and does not [=SanitizerConfig/contain=] |elementName|:
1. [=/remove=] |child|.
1. If |config|["{{SanitizerConfig/replaceWithChildrenElements}}"] [=SanitizerConfig/contains=] |elementName|:
1. Call [=sanitize core=] on |child| with |config| and
Expand All @@ -504,14 +503,13 @@ template contents). It consistes of these steps:
1. Remove |attr| from |child|.

1. If all of the following are false, then remove |attr| from |child|.
- |config|["{{SanitizerConfig/attributes}}"]
- |config|["{{SanitizerConfig/attributes}}"] [=list/exists=] and
[=SanitizerConfig/contains=] |attrName|
- |config|["{{SanitizerConfig/elements}}"]["{{SanitizerElementNamespaceWithAttributes/attributes}}"]
[=SanitizerConfig/contains=] |attrName|
- "data-" is a [=code unit prefix=] of [=Attr/local name=] and
[=Attr/namespace=] is `null` and
|config|["{{SanitizerConfig/dataAttributes}}"] is true
- |config|["{{SanitizerConfig/otherMarkup}}"]
1. If |handle javascript navigation urls| and &laquo;[|elementName|, |attrName|]&raquo; matches an entry in the
[=navigating URL attributes list=], and if |attr|'s [=protocol=] is
"`javascript:`":
Expand Down Expand Up @@ -563,7 +561,6 @@ To <dfn for="Sanitizer">set a config</dfn> |config| on a {{Sanitizer}} |sanitize
1. Call |sanitizer|.{{Sanitizer/removeAttribute()|removeAttribute}}(|item|).
1. Call |sanitizer|.{{Sanitizer/setComment()|setComment}}(|config|[{{SanitizerConfig/comments}}]).
1. Call |sanitizer|.{{Sanitizer/setDataAttributes()|setDataAttributes}}(|config|[{{SanitizerConfig/dataAttributes}}]).
1. Call |sanitizer|.{{Sanitizer/setOtherMarkup()|setOtherMarkup}}(|config|[{{SanitizerConfig/otherMarkup}}]).

Note: Previous versions of this spec had elaborate definitions of how to
canonicalize a config. This has now effectively been moved into the method
Expand Down Expand Up @@ -657,7 +654,6 @@ It is as follows:
attributes: [],
removeAttributes: [],
comments: true,
otherMarkup: true,
}
```

Expand All @@ -671,7 +667,6 @@ script-content, and nothing else. It is as follows:
],
removeAttributes: [....],
comments: true,
otherMarkup: true
}
```

Expand Down

0 comments on commit 764d394

Please sign in to comment.