Closed
Bug 74281
Opened 25 years ago
Closed 19 years ago
inline style sheet's href is document url (should be null)
Categories
(Core :: DOM: CSS Object Model, defect)
Core
DOM: CSS Object Model
Tracking
()
RESOLVED
FIXED
People
(Reporter: jruderman, Assigned: bzbarsky)
References
Details
(Whiteboard: (py8ieh: file http://www.hixie.ch/tests/evil/dom/css/001.cgi bug))
Attachments
(2 files)
|
1.14 KB,
patch
|
peterv
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
|
22.45 KB,
patch
|
Details | Diff | Splinter Review |
Steps to reproduce:
1. Load http://www.squarefree.com/bookmarklets/
2a. Type into the location bar: javascript:alert(document.styleSheets[0].href)
2b. Type into the location bar: javascript:document.styleSheets[0].href
Result:
2a: See document's href in an alert
2b: See document's href as a new document
Expected:
2a: See "null" in the alert.
2b: Nothing should happen, since the function should have returned null.
Note:
IE has document.styleSheets[0].href return an empty string. I think that's
incorrect, since the spec says it should be null.
Spec:
http://www.w3.org/TR/DOM-Level-2-Style/stylesheets.html#StyleSheets-StyleSheet
| Reporter | ||
Updated•25 years ago
|
Summary: inline style sheet's href is document href (should be null) → inline style sheet's href is document url (should be null)
Comment 1•25 years ago
|
||
Not a showstopper currently, aiming for mozilla1.0.
Status: NEW → ASSIGNED
OS: Windows 98 → All
Hardware: PC → All
Target Milestone: --- → mozilla1.0
Comment 2•25 years ago
|
||
jst, as long as strings can't be null this can't be implemented, correct?
I have a patch that implements IE's behavior (i.e. returns an empty string when
the stylesheet is inline) in my tree.
Comment 3•25 years ago
|
||
Fabian, you're right, but make your patch call SetDOMStringToNull(theString);
and we could check this in, for now it'll only make the string empty, but once
we actually support null strings things will work as specified.
Comment 4•25 years ago
|
||
Comment 5•25 years ago
|
||
peterv, glazou, comments on the patch please?
Comment 6•25 years ago
|
||
Comment on attachment 47848 [details] [diff] [review]
Proposed fix for bug 74281. Set href to null for inline stylesheets.
>+ if(is_inline) {
Nit: add a space after the if. r=peterv.
Attachment #47848 -
Flags: review+
Comment 7•25 years ago
|
||
Comment on attachment 47848 [details] [diff] [review]
Proposed fix for bug 74281. Set href to null for inline stylesheets.
What peterv said, plus, change mDocument->GetBaseURL() to mDocument->GetDocumentURL().
sr=jst
Attachment #47848 -
Flags: superreview+
Comment 8•25 years ago
|
||
jst, we've been through this before ;). See
http://lxr.mozilla.org/seamonkey/source/content/html/style/src/nsCSSLoader.cpp#1296.
Comment 9•25 years ago
|
||
Hmm, ok, that seems wrong, but I'm ok with this patch as is then (appart from
the missing space).
don't forget a whitespace after if in if(!mDocument)
r=glazman
Comment 11•25 years ago
|
||
Technically, this patch is wrong.
If foo.xml contains:
<?xml-stylesheet href="foo.xml"?>
<yasl xmlns="http://style.example.org/yasl/">
<select target=":root">
<color="green"/>
</select>
</yasl>
...where yasl is yet another style language, this one in XML, then the stylesheet
of that document should have an href even though it is the same URI as the
document itself.
A contrived case, I agree, but if we're going to be compliant...
Comment 12•25 years ago
|
||
I'll let you argue with glazou peterv & jst, I'm not qualified to comment on
that ;-)
Comment 13•25 years ago
|
||
It occured to me that my patch changes nsCSSStyleSheet:GetHref(), and your
example, Hixie, uses another style language. So ns_CSS_StyleSheet shouldn't be
called in the first place.
Comment 14•25 years ago
|
||
But as I pointed out on IRC, it wouldn't work for a case where the URI of the
document and the stylesheet were the same, even though they were different files.
e.g., http://www.hixie.ch/tests/evil/dom/css/001.cgi
Note that we currently pass this test as far as this bug is concerned (although we
do fail to get the right CSS file, unlike IE which passes all versions of this
test -- including the cached one).
Whiteboard: (py8ieh: file http://www.hixie.ch/tests/evil/dom/css/001.cgi bug)
Comment 15•25 years ago
|
||
To handle that correctly we probably need to rewrite part of the CSS loader.
Comment 16•24 years ago
|
||
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1
(you can query for this string to delete spam or retrieve the list of bugs I've
moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
Updated•24 years ago
|
Target Milestone: mozilla1.0.1 → ---
Comment 17•23 years ago
|
||
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
Status: ASSIGNED → NEW
| Assignee | ||
Comment 18•22 years ago
|
||
It's got some irrelevant stuff in it and won't compile in debug mode ('cause of
const issues), but it's the general idea.
| Assignee | ||
Comment 19•19 years ago
|
||
The patch for bug 397427 fixed this. And the test checked in for that bug covers this bug as well.
Assignee: general → bzbarsky
Flags: in-testsuite+
| Assignee | ||
Updated•19 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•