Closed Bug 416197 Opened 13 years ago Closed 13 years ago

Value excerpting only applies to child nodes

Categories

(Toolkit Graveyard :: Microformats, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mkaply, Assigned: mkaply)

References

()

Details

Attachments

(1 file)

After lots of discussion on microformats IRC (and finally finding a reference), it appears that the intent of the class="value" design pattern for microformats was that it should only grab children with the class, not descendants.
After we get the values, go through and make sure they are all immediate children of the node we queried them from.
Attachment #302861 - Flags: review?(sayrer)
Comment on attachment 302861 [details] [diff] [review]
Fix for problem plus test


>+        /* Verify that values are children of the propnode */
>+        for (let i=0; i < values.length; i++) {
>+          if (values[i].parentNode != propnode) {
>+            values.splice(i,1);
>+            i--;
>+          }
>+        }

Pretty nasty looking. I can live with it, but please try to find a prettier way to write this.
Attachment #302861 - Flags: review?(sayrer) → review+
Comment on attachment 302861 [details] [diff] [review]
Fix for problem plus test

I did make a change per rsayre's request - I enumerate backwards through the array to avoid the i--. It will be checked in like that.
Attachment #302861 - Flags: approval1.9?
Attachment #302861 - Flags: approval1.9? → approval1.9+
Fix checked in.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.