This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 244569 - Incorrect formatting for div nested inside th element
Summary: Incorrect formatting for div nested inside th element
Status: RESOLVED WORKSFORME
Alias: None
Product: web
Classification: Unclassified
Component: HTML Editor (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Milutin Kristofic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-18 04:07 UTC by _ gtzabari
Modified: 2015-09-04 08:59 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2014-05-18 04:07:26 UTC
Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 1.1
Java: 1.8.0_05; Java HotSpot(TM) 64-Bit Server VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Windows 7 version 6.1 running on amd64; Cp1252; en_CA (nb)
User directory: C:\Users\Gili\AppData\Roaming\NetBeans\8.0
Cache directory: C:\Users\Gili\AppData\Local\NetBeans\Cache\8.0

1. Given:
    <th>
      <div class="ui checkbox">
        <input type="checkbox"><label class="label">Select</label>
      </div>
    </th>

2. Netbeans produces the following code formatting:

    <th>
  <div class="ui checkbox">
    <input type="checkbox"><label class="label">Select</label>
  </div>
</th>

Meaning, it is applying an indentation level of -2 instead of +1 for unknown reasons.
Comment 1 Vladimir Riha 2014-05-19 07:21:41 UTC
reproducible

Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 1.1
Java: 1.8.0_05; Java HotSpot(TM) Client VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Linux version 3.2.0-60-generic-pae running on i386; UTF-8; en_US (nb)
Comment 2 David Konecny 2014-08-04 00:02:12 UTC
This looks like <th> is not a valid HTML5 tag? It re-indents the document fine if HTML version of the document is changed to 4.0 or if <th> is changed into <td>.
Comment 3 Vladimir Riha 2014-08-04 05:52:52 UTC
It is a valid element, table cell header. The "full" code is

        <table>
            <thead>
                <tr>
                    <th>
            <div class="ui checkbox">
                <input type="checkbox"><label class="label">Select</label>
            </div>
        </th>
    </tr>
</thead>
Comment 4 David Konecny 2014-08-04 22:16:42 UTC
Then the mistake is not in the indenter but in the HTML's DTD(??)(or in NetBeans support for it?) because it reports <th> as erroneous.
Comment 5 Vladimir Riha 2014-08-05 08:11:22 UTC
I'm sorry I left out the closing </table> in the code from comment #3. Which DTD do you have? I have <!DOCTYPE html> and it does not show any errors (when the </table> is present)
Comment 6 David Konecny 2014-08-05 20:54:43 UTC
Sorry Lada, I'm pretty cryptic too. Here is what I did: I removed "<!DOCTYPE html>" from the top of the HTML document. That makes "HTML version cannot be determined" light bulb come up. Now if I change (using this light bulb) "project default to HTML 4.*" then re-indentation works; if I switch it to "HTML 5" then re-indentation is broken. So my quick conclusion is that HTML 5 DTD (or whatever it is for HTML5) tells indenter that combination of tags is invalid and hence the indentation gets broken.

I can be wrong of course.
Comment 7 Milutin Kristofic 2015-09-04 08:59:56 UTC
I checked current version of Netbeans and this is already fixed.

<!DOCTYPE html>

<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <table>
            <thead>
                <tr>
                    <th>
                        <div class="ui checkbox">
                            <input type="checkbox"><label class="label">Select</label>
                        </div>
                    </th>
                </tr>
            </thead>
        </table>
    </body>
</html>


Probably Netbeans DTD for HTML5 missed that th can be child of tr. I updated current version of Netbeans HTML5 dtd.

Product Version: NetBeans IDE Dev (Build 201508280002)
Java: 1.8.0_51; Java HotSpot(TM) 64-Bit Server VM 25.51-b03
Runtime: Java(TM) SE Runtime Environment 1.8.0_51-b16