Skip to content
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

Fix attribute annotation code for FACEs #210

Merged
merged 1 commit into from
Oct 19, 2019
Merged

Fix attribute annotation code for FACEs #210

merged 1 commit into from
Oct 19, 2019

Conversation

domenic
Copy link
Member

@domenic domenic commented Oct 19, 2019

The root issue fixed here is that the domintro for custom elements was not properly listing the attribute explanation for readonly.

This fixes several related issues:

  • <span>form-associated custom elements</span> was not matching the
    regex that was looking for <code> in the attribute index.
  • Changing the regex to look for span or code causes many other lines to
    be picked up. Thus, we introduce the new 'tr' state into the state
    machine to better detect the first line of a <tr>.
  • Even with that, we were now dying on global attributes, since they
    don't have a domintro to get substituted in to. So we remove that
    error state.
  • Finally, we were now substituting in even in cases that just mention
    the attribute, like "Global attributes, except the is attribute". So,
    we need to add an escape hatch for that.

I've tested that this produces the following diff on the full spec:

@@ -22284,7 +22284,7 @@ wormhole connection.&lt;/mark>&lt;/p></code></pre>
    <dd><span>Phrasing content</span>.</dd>
    <dt><span data-x="concept-element-attributes">Content attributes</span>:</dt>
    <dd><span>Global attributes</span></dd>
-   <dd>Also, the <code data-x="attr-dir">dir</code> global attribute has special semantics on this element.</dd>
+   <dd>Also, the <code data-x="attr-dir">dir</code> global attribute has special semantics on this element: <span data-x="the directionality">The text directionality</span> of the element.</dd>
    <dt><span data-x="concept-element-dom">DOM interface</span>:</dt>
    <dd>Uses <code>HTMLElement</code>.</dd>
   </dl>
@@ -22345,7 +22345,7 @@ wormhole connection.&lt;/mark>&lt;/p></code></pre>
    <dd><span>Phrasing content</span>.</dd>
    <dt><span data-x="concept-element-attributes">Content attributes</span>:</dt>
    <dd><span>Global attributes</span></dd>
-   <dd>Also, the <code data-x="attr-dir">dir</code> global attribute has special semantics on this element.</dd>
+   <dd>Also, the <code data-x="attr-dir">dir</code> global attribute has special semantics on this element: <span data-x="the directionality">The text directionality</span> of the element.</dd>
    <dt><span data-x="concept-element-dom">DOM interface</span>:</dt>
    <dd>Uses <code>HTMLElement</code>.</dd>
   </dl>
@@ -66865,10 +66865,10 @@ document.body.append(parent);
    <dt><span data-x="concept-element-content-model">Content model</span>:</dt>
    <dd><span>Transparent</span>.</dd>
    <dt><span data-x="concept-element-attributes">Content attributes</span>:</dt>
-   <dd><span>Global attributes</span>, except the <code data-x="attr-is">is</code> attribute</dd>
+   <dd><span>Global attributes</span>, except the <code data-x="attr-is">is</code> attribute<!-- no-annotate --></dd>
    <dd><code data-x="attr-fae-form">form</code>, for <span data-x="form-associated custom element">form-associated custom elements</span> &mdash; Associates the element with a <code>form</code> element</dd>
    <dd><code data-x="attr-fe-disabled">disabled</code>, for <span data-x="form-associated custom element">form-associated custom elements</span> &mdash; Whether the form control is disabled</dd>
-   <dd><code data-x="attr-face-readonly">readonly</code>, for <span data-x="form-associated custom element">form-associated custom elements</span></dd>
+   <dd><code data-x="attr-face-readonly">readonly</code>, for <span data-x="form-associated custom element">form-associated custom elements</span> &mdash; Affects <code data-x="dom-ElementInternals-willValidate">willValidate</code></dd>
    <dd><code data-x="attr-fe-name">name</code>, for <span data-x="form-associated custom element">form-associated custom elements</span> &mdash; Name of the element to use for <span>form submission</span> and in the <code data-x="dom-form-elements">form.elements</code> API </dd>
    <dd>Any other attribute that has no namespace (see prose).</dd>
    <dt><span data-x="concept-element-dom">DOM interface</span>:</dt>

For dir, we can either add <!-- no-annotate -->, or we can add actually special definitions for bdi and bdo.

This fixes several related issues:

* `<span>form-associated custom elements</span>` was not matching the
  regex that was looking for `<code>` in the attribute index.
* Changing the regex to look for span or code causes many other lines to
  be picked up. Thus, we introduce the new 'tr' state into the state
  machine to better detect the first line of a <tr>.
* Even with that, we were now dying on global attributes, since they
  don't have a domintro to get substituted in to. So we remove that
  error state.
* Finally, we were now substituting in even in cases that just mention
  the attribute, like "Global attributes, except the is attribute". So,
  we need to add an escape hatch for that.
domenic added a commit to whatwg/html that referenced this pull request Oct 19, 2019
* Adds an annotation to prevent "is" from getting over-explained, per
  whatwg/html-build#210.
* Removes the double description of the disabled attribute
  (attr-fe-disabled), once for form elements and once for
  form-associated custom elements. There is only one <dfn>
  so there should be only one attribute index entry.
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

Mike should probably review the Perl, but this sounds good to me.

Copy link
Contributor

@sideshowbarker sideshowbarker left a comment

Choose a reason for hiding this comment

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

Thanks for doing this

@domenic domenic merged commit d77bb0d into master Oct 19, 2019
@domenic domenic deleted the face-fix branch October 19, 2019 15:09
domenic added a commit to whatwg/html that referenced this pull request Oct 19, 2019
* Adds an annotation to prevent "is" and "dir" from getting
  over-explained, per whatwg/html-build#210.
* Removes the double description of the disabled attribute
  (attr-fe-disabled), once for form elements and once for
  form-associated custom elements. There is only one <dfn>
  so there should be only one attribute index entry.
domenic added a commit to whatwg/html that referenced this pull request Oct 19, 2019
* Adds an annotation to prevent "is" and "dir" from getting
  over-explained, per whatwg/html-build#210.
* Removes the double description of the disabled attribute
  (attr-fe-disabled), once for form elements and once for
  form-associated custom elements. There is only one <dfn>
  so there should be only one attribute index entry.
zcorpan pushed a commit to whatwg/html that referenced this pull request Nov 6, 2019
* Adds an annotation to prevent "is" and "dir" from getting
  over-explained, per whatwg/html-build#210.
* Removes the double description of the disabled attribute
  (attr-fe-disabled), once for form elements and once for
  form-associated custom elements. There is only one <dfn>
  so there should be only one attribute index entry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants