Closed Bug 867540 Opened 7 years ago Closed 7 years ago

Search by attribute treats missing attribute as the string "null"

Categories

(Other Applications :: DOM Inspector, defect)

defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: neil, Assigned: neil)

References

Details

Attachments

(3 files)

Steps to reproduce problem:

1. Inspect an HTML document
2. Find Nodes
3. Search by attr
4. Enter a bogus attribute name
5. Enter null as the value

Expected result: End of document reached.

Actual result: Matches every element in the document.
Attached patch Quick hackSplinter Review
This doesn't work for empty attributes.
Attached patch Possible patchSplinter Review
(untested)
Attached patch Proposed patchSplinter Review
Since an empty regexp matches any string, the test is unnecessary.
Assignee: nobody → neil
Status: NEW → ASSIGNED
Attachment #744079 - Flags: review?(Sevenspade)
Comment on attachment 744079 [details] [diff] [review]
Proposed patch

Review of attachment 744079 [details] [diff] [review]:
-----------------------------------------------------------------

::: resources/content/viewers/dom/dom.js
@@ +953,5 @@
>  
>      return aWalker.currentNode &&
>             aWalker.currentNode.nodeType == nsIDOMNode.ELEMENT_NODE &&
> +           aWalker.currentNode.hasAttribute(this.mFindParams[0]) &&
> +           re.test(aWalker.currentNode.getAttribute(this.mFindParams[0]));

Weird that we allow regular expressions everywhere else except this field's value for this type of search...
Attachment #744079 - Flags: review?(Sevenspade) → review+
(In reply to Colby Russell from comment #4)
> Weird that we allow regular expressions everywhere else except this field's
> value for this type of search...

You mean for the attribute name? Could be done, I suppose...
(neil@parkwaycc.co.uk wrote in comment #5)
> (In reply to Colby Russell from comment #4)
> > Weird that we allow regular expressions everywhere else except this field's
> > value for this type of search...
> 
> You mean for the attribute name? Could be done, I suppose...

Dear meandering bugzilla reader, that's bug 867699.
Pushed: http://hg.mozilla.org/dom-inspector/rev/35137780b095
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Blocks: DOMi2.0.15
No longer blocks: DOMi2.0.16
You need to log in before you can comment on or make changes to this bug.