Closed
Bug 237478
Opened 21 years ago
Closed 21 years ago
need property on HTML element contaning document url
Categories
(Core :: DOM: Core & HTML, enhancement)
Core
DOM: Core & HTML
Tracking
()
VERIFIED
INVALID
People
(Reporter: db48x, Assigned: db48x)
Details
Attachments
(1 file)
6.20 KB,
patch
|
Details | Diff | Splinter Review |
with such a property, it's easy to write a user stylesheet that only applies to
one document.
Assignee | ||
Comment 1•21 years ago
|
||
not entirely sure why this doesn't work yet, but I need a place to put it while
I get a tree that isn't broken so badly.
Assignee: general → db48x
Status: NEW → ASSIGNED
![]() |
||
Comment 2•21 years ago
|
||
> with such a property, it's easy to write a user stylesheet
Huh? Stylesheets can't match DOM properties. So I'm not sure what you're
talking about here... And why is this HTML-specific? What problem are you
actually trying to solve?
As for the patch:
- NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLHtmlElement)
+ NS_INTERFACE_MAP_ENTRY(nsIDOMNSHTMLHtmlElement)
is wrong. You need both interface entries. And presumably you need to fix the
classinfo for HTML elements too.
> + htmldoc = (nsIDOMHTMLDocument*)doc;
Is a crash waiting to happen. You can have an nsHTMLHTMLElement inside a
non-HTML document.
Comment 3•21 years ago
|
||
Um, care to explain a bit more about why we would add such a property? In
general, I'm very much against adding new properties to all DOM elements, given
the right reasons, sure, but I didn't see any reasons here yet.
Comment 4•21 years ago
|
||
This is cruising for INVALID. Daniel, can you state the problem you are trying
to solve, before hacking a patch that adds whole new files to Gecko?
/be
Comment 5•21 years ago
|
||
Marking INVALID, please reopen if you think this is a valid bug and you've got
answers to our questions above.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
Assignee | ||
Comment 6•21 years ago
|
||
Sorry about that, I've just been out of my apartment nearly all week.
(In reply to comment #3)
> Um, care to explain a bit more about why we would add such a property? In
> general, I'm very much against adding new properties to all DOM elements, given
> the right reasons, sure, but I didn't see any reasons here yet.
The idea is to allow a stylesheet to match only documents at a particular url.
(e.g. html[baseURI*="bugzilla.mozilla.org"] { ... })
Note that the patch only adds a property to a single DOM element, not all of
them. It should also be noted that the existing DOM3 attribute baseURI would
actually work perfectly, and so I'll probably just use it. I only added a new
one because I forgot about baseURI.
(In reply to comment #4)
> This is cruising for INVALID. Daniel, can you state the problem you are trying
> to solve, before hacking a patch that adds whole new files to Gecko?
>
> /be
The reason I didn't bother to state my problem clearly the first time is because
I was told there was already a bug requesting this feature, but we couldn't find it.
(In reply to comment #2)
> Huh? Stylesheets can't match DOM properties. So I'm not sure what you're
> talking about here... And why is this HTML-specific? What problem are you
> actually trying to solve?
>
Well, they can. The reason the code in this patch doesn't work is because the
code that matches attribute selectors gets the attribute from GetAttr(), so I
need to finish reading that code.
> is wrong. You need both interface entries. And presumably you need to fix the
> classinfo for HTML elements too.
And also I couldn't access it through the DOM because I forgot about the classinfo.
> > + htmldoc = (nsIDOMHTMLDocument*)doc;
>
> Is a crash waiting to happen. You can have an nsHTMLHTMLElement inside a
> non-HTML document.
of course.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
(In reply to comment #6)
> Well, they can. The reason the code in this patch doesn't work is because the
> code that matches attribute selectors gets the attribute from GetAttr(), so I
> need to finish reading that code.
As it should.
There are much better solutions to this problem, such as an at-rule, e.g.:
@-moz-url "http://bugzilla.mozilla.org/" {
p { color: green; }
}
@-moz-urls "http://bugzilla.mozilla.org/show_bug.cgi" {
p { color: red; }
}
Status: REOPENED → RESOLVED
Closed: 21 years ago → 21 years ago
Resolution: --- → INVALID
(as described in http://lists.w3.org/Archives/Public/www-style/2003Dec/0058.html)
Comment 9•21 years ago
|
||
(Isn't WONTFIX a better resolution?)
No, because the proposed solution would actually violate relevant standards.
Assignee | ||
Comment 11•21 years ago
|
||
yes, I'm sure there are, but it probably depends on your perspective. My first
thought was actually a pseudoclass.
:baseURI("bugzilla.mozilla.org") { color: green; }
The reason I went with an attribute instead was for the prefix/suffix matching.
Of course, a regex would be sweet, but that's not likely to ever happen.
Also, using baseURI is awesome because it applies to all elements, not just <html>:
img[baseURI*="doubleclick.net"] { color: green; }
img:baseURI("doubleclick.net") { color: green; }
Assignee | ||
Comment 12•21 years ago
|
||
that said, if this will never get accepted into mozilla, that's ok. I'm working
on something else that should remove my personal need for something like this.
An at-rule is a lot easier for authors who want to write more than one rule
applying to the site(s) in question.
Assignee | ||
Comment 14•21 years ago
|
||
granted
Updated•21 years ago
|
Status: RESOLVED → VERIFIED
Comment 15•21 years ago
|
||
see bug 238099
You need to log in
before you can comment on or make changes to this bug.
Description
•