Closed Bug 8862 Opened 25 years ago Closed 25 years ago

listStyleImage not directly updated

Categories

(Core :: DOM: CSS Object Model, defect, P3)

x86
Windows 95
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: martin.honnen, Assigned: pierre)

Details

(Whiteboard: [TESTCASE])

Attachments

(4 files)

I used a STYLE with a
  list-style-image
which worked. When trying to change that image with
  elementRef.style.listStyleImage = 'url(someImage.gif)';
the change got only shown after I changed the display property of the
containing list element to
  none
and then back to block. Complete example

<HTML>
<HEAD>
<STYLE>
#aListItem {
  list-style-image: url(plus.gif);
}
</STYLE>
<SCRIPT>
function changeImage () {
  var aListItem = document.getElementById('aListItem');
  aListItem.style.listStyleImage =
    aListItem.style.listStyleImage.indexOf('minus.gif') != -1 ? 'url(plus.gif)'
: 'url(minus.gif)';
  alert(aListItem.style.listStyleImage);
}
</SCRIPT>
</HEAD>
<BODY>
<UL ID="aUL">
<LI ID="aListItem">
Kibology for all.
</LI>
</UL>
<BUTTON ONCLICK="changeImage ()">
change image
</BUTTON>
<BUTTON ONCLICK="var aUL = document.getElementById('aUL'); aUL.style.display =
'none'; aUL.style.display = 'block';">
change display of list
</BUTTON>
</BODY>
</HTML>
Attached image image for bug demo
Attached image image for bug demo
Whiteboard: [TESTCASE]
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Works now, with Sept 14 build (Linux).

I get:

JavaScript Error: uncaught exception: [Exception... "Component does not have
requested interface"  code: "-2147467262" nsresult: "0x80004002
(NS_NOINTERFACE)"  location: "file:///home/shaver/mozilla/tests/8679/8679.html
Line: 10"]

when I click the "change image" button, but the image changes.  Line 10 is:
  var aListItem = document.getElementById('aListItem');
but that's almost certainly not where the error's occuring, because the style
change that follows is executed.  If I take out
    alert(aListItem.style.listStyleImage);
I don't get the error, so I think that's the problem.

I'm marking this fixed; let's deal with the exception later.
Status: RESOLVED → REOPENED
It seems to be fixed when using DOM to change the list-style-image property, but
when the className property is changed to a another class with a different
list-style-image, this bug is creeps up again.

See:
http://m1.aol.com/supersamat/dom/toc/table-of-contents.htm
and for a screenshot'ed explanation if not understood:
http://m1.aol.com/supersamat/dom/toc/moz-bug/liststyleimage.html

I've only tested on Win32. I did not feel like filing a new bug since this is
just a variation of 8862 (this one).
Resolution: FIXED → ---
Target Milestone: M12
Clearing FIXED resolution due to reopen.
Assigning to Pierre, the new style system owner. Changing the className should,
especially in this case, cause recreation of frames for the element. Pierre,
feel free to discuss this with me when you get to it.
Assignee: vidur → pierre
Status: REOPENED → NEW
Status: NEW → RESOLVED
Closed: 25 years ago25 years ago
Resolution: --- → FIXED
Fixed checked in nsGenericHTMLElement.cpp v1.136 per Vidur's suggestion.
Component: DOM Level 2 → DOM Style
Taking QA Contact on all open or unverified DOM Style bugs...
QA Contact: vidur → ian
seems to work now
Status: RESOLVED → VERIFIED
For the record, the fix for this bug was completely incorrect and just blew away
everything for class attribute changes instead of using the correct style change
mechanisms.  The correct fix was made in bug 21225.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: