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

Set dirty value flag for setRangeText() #2435

Merged
merged 2 commits into from
Mar 16, 2017
Merged

Set dirty value flag for setRangeText() #2435

merged 2 commits into from
Mar 16, 2017

Conversation

annevk
Copy link
Member

@annevk annevk commented Mar 14, 2017

Fixes #2425.

@domenic
Copy link
Member

domenic commented Mar 14, 2017

Content LGTM. Editorially this is strange; just reading the text it sounds weird because two different concepts are using the term "dirty value flag", so unless you hover over the links, the sentence just looks very wrong. I'm not sure if there's any good fix for that. Maybe "input dirty value flag" and "textarea dirty value flag"?

@domenic domenic added topic: forms needs tests Moving the issue forward requires someone to write tests labels Mar 14, 2017
@annevk
Copy link
Member Author

annevk commented Mar 14, 2017

I think the right fix would be to make it a shared concept, but I was lazy. As for tests, the issue mentions some that could be uplifted from Gecko.

@domenic domenic removed the needs tests Moving the issue forward requires someone to write tests label Mar 14, 2017
@domenic
Copy link
Member

domenic commented Mar 14, 2017

#setting-minimum-input-length-requirements:-the-minlength-attribute seems to use <var>dirty value flag</var>. That seems a bit better to me?

@annevk
Copy link
Member Author

annevk commented Mar 15, 2017

@domenic that seems fine. Do you think it makes sense for two elements to share a slot? I didn't investigate if we already do that for input and textarea, I thought we might. I could file a follow-up to investigate that.

@bzbarsky would you be okay uplifting the tests from Gecko?

@bzbarsky
Copy link
Contributor

@bzbarsky would you be okay uplifting the tests from Gecko?

Absolutely. I can just create a wpt PR, or move them to the to-be-synced bits in Gecko's tests and wait for jgraham to uplift them, or whatever. Just let me know.

@annevk
Copy link
Member Author

annevk commented Mar 15, 2017

@bzbarsky whatever is most expedient for you is fine. If you could leave some pointer here of that happening that should be sufficient for archeologists.

@bzbarsky
Copy link
Contributor

I'll do this gecko-side, then. Minimal merge pain for me. Will land it once this PR is in.

@annevk
Copy link
Member Author

annevk commented Mar 15, 2017

Okay, I think it's fine to land it now as long as the commit message includes a pointer here, but up to you. This PR is blocked on some feedback from @domenic.

@domenic
Copy link
Member

domenic commented Mar 15, 2017

Do you think it makes sense for two elements to share a slot? I didn't investigate if we already do that for input and textarea, I thought we might. I could file a follow-up to investigate that.

I do. Yesterday I thought that there was no good place to put the definition, but now I'm thinking the section "A form control's value" is a pretty good place for it. Maybe I'm forgetting some reason that made less sense yesterday.

We can also do the <var> version for now and file a follow-up issue for the share-a-slot version. Heck, we can do the awkward-phrasing version in this PR if you really want; it's not a big deal, as long as there's a follow-up issue filed.

@annevk annevk force-pushed the annevk/setrangetext branch from 50d7008 to 56c35cc Compare March 15, 2017 18:24
@annevk
Copy link
Member Author

annevk commented Mar 15, 2017

I tried to fix both here. Used distinct commits to separate editorial from normative change.

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

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

I think we need a better description of what it is, or leave the description out. Sorry this is dragging on a bit.

source Outdated
@@ -49906,7 +49903,7 @@ interface <dfn>HTMLTextAreaElement</dfn> : <span>HTMLElement</span> {

<p>The <dfn><code data-x="attr-textarea-maxlength">maxlength</code></dfn> attribute is a <span
data-x="attr-fe-maxlength">form control <code data-x="">maxlength</code> attribute</span> controlled
by the <code>textarea</code> element's <span data-x="concept-textarea-dirty">dirty value
by the <code>textarea</code> element's <span data-x="concept-fe-dirty">dirty value
Copy link
Member

Choose a reason for hiding this comment

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

Here and below, I think the "controlled by the X element's dirty value flag" is now redundant. That's generically part of the definition of form control maxlength attribute now.

Copy link
Member Author

Choose a reason for hiding this comment

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

I ended up removing this four times.

source Outdated
@@ -51118,6 +51115,10 @@ interface <dfn>HTMLLegendElement</dfn> : <span>HTMLElement</span> {
email fields might translate that into a <span data-x="concept-fe-value">value</span> of "<code
data-x="">[email protected]</code>" (without the leading whitespace).</p>

<p id="concept-input-value-dirty-flag"><span id="concept-textarea-dirty"></span><code>input</code>
and <code>textarea</code> elements have a <dfn data-x="concept-fe-dirty">dirty value flag</dfn>.
This is used to determine what to display to the user.</p>
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is an accurate description of how it's used. I would say it's used to determine the interaction between the DOM structure (value content attribute or text node children) and the form control's value. Not sure how to phrase "DOM structure" better.

Copy link
Contributor

Choose a reason for hiding this comment

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

The simplest thing may be to say that it's used to determine the interaction between the default value and the value. If the flag is not set, the value tracks the default value. If it's set, the value is independent of the default value.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, I contrasted value and the value content attribute since we don't really have a default value concept per se. I used data-x="" for the value content attribute since I didn't want to reiterate the input/textarea distinction.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think that's great, because now the definition only applies to input elements. The "default value" concept does somewhat exist; the spec says

The contents of the control represent the control's default value.

for textarea and

The value content attribute gives the default value of the input element.

for input.

Copy link
Member Author

Choose a reason for hiding this comment

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

How does it only apply to input elements?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh right, doh.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay.

@annevk annevk force-pushed the annevk/setrangetext branch from 56c35cc to cea1858 Compare March 16, 2017 08:22
@annevk annevk force-pushed the annevk/setrangetext branch from cea1858 to 0f20791 Compare March 16, 2017 15:26
@annevk
Copy link
Member Author

annevk commented Mar 16, 2017

Apologies, pushed a new version that just says default value as it should.

@domenic domenic merged commit 4c404a2 into master Mar 16, 2017
@domenic domenic deleted the annevk/setrangetext branch March 16, 2017 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants