NOTE: The current preferred location for bug reports is the GitHub issue tracker.
Bug 380 - add additional constraints on the <label> element for the cases where it has/lacks a "for" attribute
add additional constraints on the <label> element for the cases where it has/...
Status: RESOLVED FIXED
Product: Validator.nu
Classification: Unclassified
Component: HTML5 schema
HEAD
All All
: P2 normal
Assigned To: Michael[tm] Smith
: 427 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-12-24 14:19 CET by Michael[tm] Smith
Modified: 2009-04-07 18:14 CEST (History)
1 user (show)

See Also:


Attachments
diff showing changes to assertions.sch (2.87 KB, patch)
2009-03-25 03:04 CET, Michael[tm] Smith
Details
patch for label@for descendant-checking in Assertions.java (4.03 KB, patch)
2009-03-31 14:48 CEST, Michael[tm] Smith
Details
updated patch that moves label@for checking to attribute loop (4.31 KB, patch)
2009-03-31 15:25 CEST, Michael[tm] Smith
Details
additional patch to check for label with multiple labeled descendants (4.53 KB, patch)
2009-03-31 21:49 CEST, Michael[tm] Smith
Details
updated patch for label with multiple labeled descendants + refinement to label@for checking (4.61 KB, patch)
2009-04-01 13:00 CEST, Michael[tm] Smith
Details
label with multiple labelable descendants (5.36 KB, patch)
2009-04-02 10:24 CEST, Michael[tm] Smith
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael[tm] Smith 2008-12-24 14:19:16 CET
The content model for the <label> element states the following constraints:

"If the element has a for attribute: Phrasing content, but with no descendant labelable form-associated elements or label elements.
Otherwise: Phrasing content, but with at most one descendant labelable form-associated element, and with no descendant label elements."

The current assertions.sch file does not seem to capture the "no descendant labelable form-associated elements" for the case when there is a "for" attribute, nor the "at most one descendant labelable form-associated element" for the case where there is not "for" attribute.
Comment 1 Michael[tm] Smith 2009-03-24 12:29:09 CET
The content model now reads: "Phrasing content, but with no descendant labelable form-associated elements unless it is the element's labeled control, and no descendant label elements." and "If the for attribute is not specified, but the label element has a labelable form-associated element descendant, then the first such descendant in tree order is the label element's labeled control."

But, anyway, the language for the label[not(@for)] case seems to be stating the same constraint as "with at most one descendant labelable form-associated element".

I'll take a look at updating the assertions.sch file to capture the constraints. After that, maybe I can take a shot at updating the corresponding Java code so that I can actually test whether I've got it captured correctly or not.
Comment 2 Michael[tm] Smith 2009-03-25 03:04:55 CET
Created attachment 63 [details]
diff showing changes to assertions.sch

this diff adds the constraint checking in assertions.sch only; if it looks OK, I'll go ahead and commit it. In the mean time, I'm reading the org.whattf.checker.schematronequiv.Assertions code to see if I can figure out how to add the same constraint checks there
Comment 3 Michael[tm] Smith 2009-03-25 07:33:42 CET
landed change to assertions.sh in r389
http://svn8.cvsdude.com/vvc/whattf/syntax?view=revision&revision=389
Comment 4 Michael[tm] Smith 2009-03-31 14:48:11 CEST
Created attachment 66 [details]
patch for label@for descendant-checking in Assertions.java 

Tested and working as expected per current spec as far as I can tell. There's probably a better way to do this, but this is the best I could figure out on my own...
Comment 5 Michael[tm] Smith 2009-03-31 15:25:40 CEST
Created attachment 67 [details]
updated patch that moves label@for checking to attribute loop
Comment 6 Michael[tm] Smith 2009-03-31 15:43:53 CEST
landed label@for descendant checking in r394
svn8.cvsdude.com/vvc/whattf/syntax?view=revision&revision=394
Comment 7 Michael[tm] Smith 2009-03-31 18:40:40 CEST
revised assertions.sch to use explicit @id checks for label@for descendants (instead of id() check)
r395 http://svn8.cvsdude.com/vvc/whattf/syntax?view=revision&revision=395
Comment 8 Michael[tm] Smith 2009-03-31 21:49:04 CEST
Created attachment 70 [details]
additional patch to check for label with multiple labeled descendants
Comment 9 Michael[tm] Smith 2009-04-01 13:00:13 CEST
Created attachment 71 [details]
updated patch for label with multiple labeled descendants + refinement to label@for checking

changed label@for checking to just set a hasFor boolean instead of putting the "for" values into a hashmap
Comment 10 Michael[tm] Smith 2009-04-02 10:24:15 CEST
Created attachment 72 [details]
label with multiple labelable descendants

adding warning messages to indicate which label has multiple labelable descendants; however, not working as expected because it's reporting the location of the offending descendant, instead of reporting the location of the label
Comment 11 Michael[tm] Smith 2009-04-02 12:23:48 CEST
landed "no label with multiple labelable descendants" checking in r398
http://svn8.cvsdude.com/vvc/whattf/syntax?view=revision&revision=398
Comment 12 Michael[tm] Smith 2009-04-07 18:14:38 CEST
*** Bug 427 has been marked as a duplicate of this bug. ***