Closed Bug 708217 Opened 13 years ago Closed 13 years ago

javascript style.display = "none" does not work on some items

Categories

(Core :: DOM: HTML Parser, defect)

8 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: olivier.houdas, Unassigned)

Details

(Keywords: qawanted)

Attachments

(2 files, 1 obsolete file)

Attached file BugSpanDisplayNone.zip (obsolete) —
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0.1) Gecko/20100101 Firefox/8.0.1
Build ID: 20111120135848

Steps to reproduce:

I execuded a script which hides some items and displays some others with 
style.display = "inline"
and
style.display = "none"


Actual results:

it works on some items, but not for all.
In the attached page :
When clicking "Suivant" (right under page 1/3) it should hide page 1 and show only page 2, but it shows both page 1 and 2.
If clicking Suivant under Page 2, then it hides page 2 and shows page 3, but Page 1 remains visible
I added a test in the function which displays and hides items, and FiltrePage1 is detected, so style.display = "none" is applied to that SPAN tag, but it does not have any effect, whereas it has an effect when applied on Page 2 or Page 3.
Look for //DEBUG// in the code of the attached page, and uncomment those lines for this test.


Expected results:

It should show only one page at a time, as it does with Firefox 3.6 and 4.0, with Chrome, with Opera 8 and with IE 4.0, 5.0 and 9.0 (not tested with other versions, but basically, this page has been working everywhere and for a couple of years)
The HTML example page with the missing scripts (but this did not influence reproducing the bug, it only triggered warnings when trying in IE 9.0).
Attachment #579641 - Attachment is obsolete: true
Confirmed working as described in Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.24) Gecko/20111103 Firefox/3.6.24 ID:20111103063747

See failure in Mozilla/5.0 (Windows NT 5.1; rv:11.0a1) Gecko/20111207 Firefox/11.0a1 ID:20111207031110

No errors in error console...
This could use both a simplified testcase (attached to the bug, single file) and a regression window.
Component: General → Layout
Product: Firefox → Core
QA Contact: general → layout
Whiteboard: regressionwindow-wanted,qawanted
Whiteboard: regressionwindow-wanted,qawanted
Attachment #579642 - Attachment mime type: application/octet-stream → application/zip
Further analysis :
It is the HTML tag
<P ALIGN='CENTER'>
which screws up the behavior.

See attached simplified page (removing the line "<P ALIGN='CENTER'>" makes it work correctly)
The page has this markup (with the irrelevant parts removed):

  <p>
    <span>
      <a><h2></h2></a>
      <table>...</table>
    </span>

An HTML5-compliant parser closes the <p> when it sees the <h2>, so the DOM looks like this:

  P
   SPAN
    A
  H2
   A
  TABLE

and so forth.  In particular, the table there is no longer contained in the span, so changing display styles on the span does absolutely nothing to hide it.  This is almost certainly a behavior change from the old parser, and almost certainly purposeful.

The page should be using <div>, not <span> for things that are meant to contain blocks.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Component: Layout → HTML: Parser
QA Contact: layout → parser
Resolution: --- → INVALID
Unsurprisingly, other browsers that implement the HTML5 parsing algorithm have the same behavior.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: