Skip to content

Addressing github issues.#97

Open
ziransun wants to merge 1 commit into
Igalia:mainfrom
ziransun:github-issue-explainer
Open

Addressing github issues.#97
ziransun wants to merge 1 commit into
Igalia:mainfrom
ziransun:github-issue-explainer

Conversation

@ziransun
Copy link
Copy Markdown
Contributor

Comment thread spell-check-dictionary/README.md Outdated

```

_Note Both ```addWords()``` and ```removeWords()``` are essential for this interface. We need ```removeWords()``` to retract mistakes, mirror user unmarks, or track evolving terminology, and prevent dictionary from growing unboundedly.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not especially clear why one needs to remove during the lifetime of a page, so it might make sense to mention something about single page applications or something. Otherwise I think the assumption is "if it isn't a term, just don't load it in the first place".

Comment thread spell-check-dictionary/README.md Outdated
### 2. A Unified `CustomDictionary` Across Features
### 2. A SetLike interface
<details>
For the interface, a natural alternative would be [SetLike<DOMString>], which auto-generates a complete Set-shaped surface, familiar to JavaScript authors, composable with standard set algebra. However, we chose not to use it because:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

composable with standard set algebra

Setlikes don't support .union() and so on, more or less just the core stuff .add(), .delete(), has(), .clear(), .entries(), .keys(), .values(), [Symbol.iterator](), .size (readonly) - as far as I understand (and from looking at exiting stuff)

<details>
For the interface, a natural alternative would be [SetLike<DOMString>], which auto-generates a complete Set-shaped surface, familiar to JavaScript authors, composable with standard set algebra. However, we chose not to use it because:

* Privacy. Exposing the read operations of the interface lets any script with access to the dictionary enumerate or probe its contents.
Copy link
Copy Markdown
Member

@bkardell bkardell May 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could just keep that shape but make those no-op? Like, .has() could always return false or something? The iterables are always empty? Bc it is really similar already - idk that it makes sense to argue for just "addWords" as opposed to "add"

For the interface, a natural alternative would be [SetLike<DOMString>], which auto-generates a complete Set-shaped surface, familiar to JavaScript authors, composable with standard set algebra. However, we chose not to use it because:

* Privacy. Exposing the read operations of the interface lets any script with access to the dictionary enumerate or probe its contents.
* Batch shape matches caller intent and scales. SetLike's ```add(value)``` is single-element. In most common use cases, callers push lists, so on a SetLike surface they end up coalescing via forEach. Bespoke ```addWords(sequence<DOMString>)``` matches caller intent, batches cleanly, and remains a single operation.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be the strongest argument really

Comment thread spell-check-dictionary/README.md Outdated
### 5. DOM subtree scoped

<details>
Choosing scope for the API largely depends on use cases. For example, Document-scoped is enough for whole-page vocabularies while subtree-scoped wins when multiple forms on one page need distinct vocabularies, or when web components want isolation. We would say that Document scope and DOM-subtree scope are not mutually exclusive — they compose additively. A subtree-scoped API with union-by-default semantics behaves identically to a document-scoped one when no element opts in.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait do they? Would you really want union-by-default? I think if you are making them subtree based they should be only that language.

Comment thread spell-check-dictionary/README.md Outdated
<details>
Choosing scope for the API largely depends on use cases. For example, Document-scoped is enough for whole-page vocabularies while subtree-scoped wins when multiple forms on one page need distinct vocabularies, or when web components want isolation. We would say that Document scope and DOM-subtree scope are not mutually exclusive — they compose additively. A subtree-scoped API with union-by-default semantics behaves identically to a document-scoped one when no element opts in.

We have a use case raised by client that requires a per-page vocabulary, which document scope handles directly. We propose to proceed with this first as it's a more conservative, easier-to-spec choice, and it leaves the door open for adding a partial interface HTMLElement later if multi-vocabulary scenarios emerge.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know that this first sentence is relevant to the explainer really.

@ziransun ziransun force-pushed the github-issue-explainer branch 2 times, most recently from e6b335f to dcb8b46 Compare June 3, 2026 09:54
@ziransun ziransun force-pushed the github-issue-explainer branch from dcb8b46 to 41d74e4 Compare June 3, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants