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 198094 - Obsolete element causes problem with formatting
Summary: Obsolete element causes problem with formatting
Alias: None
Product: web
Classification: Unclassified
Component: HTML Editor (show other bugs)
Version: 7.0.1
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Milutin Kristofic
: 242590 (view as bug list)
Depends on:
Reported: 2011-04-26 15:48 UTC by Vladimir Riha
Modified: 2014-10-06 13:26 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2011-04-26 15:48:52 UTC
If you try to format following html code (simple .html filetype), because of the <big> element (or the annotation saying that it is obsolete) the formatting is incorrect at lines below this element (it should be shifted to the right in the same way that the upper lines are)

Sample source code:

<!doctype html>
        <title> TITULEK

        <!-- text elements-->
        <h1>Header 1 </h1>
        <h2>Header 2 </h2>

    <!-- lists -->


Product Version: NetBeans IDE Dev (Build 201104260000)
Java: 1.6.0_25; Java HotSpot(TM) Client VM 20.0-b11
System: Windows XP version 5.1 running on x86; Cp1250; cs_CZ (nb)
Comment 1 David Konecny 2011-06-07 18:31:30 UTC
Document is formatted according to its DTD. I do not know which DTD or Schema is used when document does not define a version but if you try

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">

then formatting will be OK. And vice versa, if you use

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "">

Then it will not but elements will be marked as erroneous.
Comment 2 Vladimir Riha 2011-06-07 19:35:34 UTC
Ok, but the sample code contains html5 doctype, so there are no DTD or Schema for html5, are they? The element <big> is marked as obsolete and all elements below have wrong intendation
Comment 3 David Konecny 2011-06-07 21:01:38 UTC
Marek might know better. Indenter is given some syntax and formats document accordingly. <big> tag is not allowed there and so parent tag is closed. Formatting of syntactically broken code is troublesome but I think it is good in this case - it shows user there is something wrong.

Also try and you will see that validation fails with error as well.
Comment 4 Marek Fukala 2011-06-08 13:12:53 UTC
The html5 has not DTD or schema AFAIR, it is fully specified-described in a text form. The <big> tag is not part of the html specification anymore so one should not use it. 

OTOH I do not understand why the parent tag is closed when an unknown tag is found? Couldn't the formater just ignore such content and align it as the other valid content of the enclosing tag? The tag itself wouldn't affect the indent of its siblings so following sample code will be formatted like this:


.. instead of current

Comment 5 David Konecny 2011-06-08 19:14:26 UTC
(In reply to comment #4)
> .. instead of current
>     <body>
>         <p>
>     <unknown>
>         <small>hello</small>
>     </unknown>
> </p>
> </body>

I will have to have a look at the code why this happens. I agree with you that even if this is broken syntax the indenter could behave better.
Comment 6 Marek Fukala 2011-06-09 09:06:28 UTC
Just a notice to my previous comment. I'm not sure how exactly the tags formatting is implemented but I need at least preserve the xml-style formatting of elements with a namespace (for facelets - xhtml).





or both examples can formatted the second way. So the unknown element's children are indented, but following siblings are not affected (enclosing tag not closed).
Comment 7 Vladimir Riha 2014-03-06 07:49:09 UTC
*** Bug 242590 has been marked as a duplicate of this bug. ***