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 165475 - [regression] "fieldset" tag in rhtml incorrectly marked
Summary: [regression] "fieldset" tag in rhtml incorrectly marked
Status: RESOLVED FIXED
Alias: None
Product: ruby
Classification: Unclassified
Component: RHTML (show other bugs)
Version: 7.0
Hardware: All All
: P3 blocker (vote)
Assignee: Erno Mononen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-19 10:52 UTC by fjan11
Modified: 2010-11-19 10:35 UTC (History)
3 users (show)

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 fjan11 2009-05-19 10:52:46 UTC
Every tag inside a <fieldset> tag in an erb file will get a red wriggly line, with the message "The tag content is unresolved", unless that tag also contains a 
<legend> tag. The <legend> tag is an optional tag so that should not be required.
Comment 1 Marek Fukala 2009-05-20 12:07:58 UTC
changeset:   132065:884910712c24
user:        Marek Fukala <mfukala@netbeans.org>
date:        Wed May 20 13:02:58 2009 +0200
summary:     #165377, 165396, 165475, 165143, 163271, 163242 - fixed a bunch of problems related to the HTML
validator/AST provider
Comment 2 fjan11 2009-05-26 12:55:59 UTC
I just checked with the latest nightly build (200905260201) and I'm afraid this bug is still there. Easy to reproduce, just try an .erb file with:

<fieldset>
<b>Hello</b>
</fieldset>

This will give errors even though it is valid XHTML.
Comment 3 Marek Fukala 2009-05-26 14:47:47 UTC
perfectly works for me if there is a proper doctype declaration for XHTML. Check following example in .xhtml file:

--------------
<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>TODO supply a title</title>
    </head>
    <body>
        <fieldset>
            <b>Hello</b>
        </fieldset>
    </body>
</html>
--------------

... no errors
Comment 4 fjan11 2009-05-26 14:56:58 UTC
Sorry to re-open this, but that is not an acceptable solution. .erb files can not normally contain a doctype declaration in Rails unless they happen to be layout 
partials. For 90%+ of the .erb files that does not work.
Comment 5 Marek Fukala 2009-05-26 16:22:18 UTC
hmm hmm, it looks like we really need a way how to specify the html doctype for code fragments (either .html file or
various templating languages).

I can think of several ways how to do that:
1) default(fallback) HTML doctype set per project (in project UI) which would apply for all html code not explicitly
declaring the doctype
2) some patterns definable per project allowing to have more doctypes for various parts of the project
3) hint - Missing HTML doctype definition + fix 'set doctype for this file/folder' for each file with html content w/o
doctype decl.

#1 seems to be the most straithforward and also simpliest to implement
#2 ???
#3 easy to use, harder to implement especially if you want to store the information with the project so it is sharable.
possibly could modify the patterns from #2.

I belive the doctype is usually the same per project so #1 could be enough. Objections?
Comment 6 Marek Fukala 2009-05-26 16:25:38 UTC
I forgot to mention that all the proposed solutions can be done in netbeans 6.8, not 6.7. So for 6.7 you need to disable
the checks per file. Some fix can may be delivered in a patch release or via autoupdate later.
Comment 7 fjan11 2009-05-26 16:34:18 UTC
I agree, #1 seems a good solution and 6.8 will be soon enough, this is just a minor annoyance. By the way, Netbeans 6.5 didn't have the problem, I guess it 
just didn't check that strictly. I haven't found a way to disable it on a per file basis like you suggest, is there an option for that?
Thanks much for looking into it!
Comment 8 Marek Fukala 2009-05-27 06:56:43 UTC
The hint for disabling/enabling the html error check was added a few days before so please download a new build.
Comment 9 Marek Fukala 2009-08-18 08:48:21 UTC

*** This issue has been marked as a duplicate of 167968 ***
Comment 10 fjan11 2009-08-18 09:00:47 UTC
Sorry, but this is not a duplicate of 167968.
In that issue it is described that Netbeans should not flag incorrect HTML if is incomplete because it is generated by a templating language.
This issue is that Netbeans actually flags a correct HTML snippet as incorrect.

For example, this snippet does not contain any template directives and will be marked as incorrect while it is correct according to W3C specs.
<fieldset><div></div></fieldset>
Comment 11 Marek Fukala 2009-08-18 10:34:26 UTC
Maybe not duplicate but I won't do anything more than disable the structure checks for embedded html code. The missing
doctype declaration is in fact the same problem - the page is not valid according to the specification if it doesn't
contain it. If I cannot determine the content type I cannot properly check... this would have to be fixed in the ruby
support. So reassigning to ruby, it is up to then if they just consider it as fixed once I fix issue #167968 or they'll
develop some better ruby proprietary fix.
Comment 12 fjan11 2009-08-18 10:36:54 UTC
But why not simply assume a doctype if none is present, as you suggested yourself earlier? This would solve 90% of the cases without any drawbacks I can 
think of?
Comment 13 Marek Fukala 2009-08-18 10:40:35 UTC
btw, I as noted in the issue #167968 I may create some simple doctype providing SPI which would languages like ruby
implement. So we can still do proper checking even w/o the declaration.
Comment 14 Marek Fukala 2009-08-18 10:41:20 UTC
html 4.01 transitional is the fallback
Comment 15 fjan11 2009-08-18 10:43:40 UTC
Thanks, that sounds great, but if html 4.01 is the fallback why is this marked as incorrect?

<fieldset><b>Hello</b></fieldset>
Comment 16 fjan11 2009-08-18 10:51:30 UTC
Sorry, never mind that last comment. I just realized that that snippet is only valid in XHTML 1.0.
Comment 17 Erno Mononen 2009-09-24 09:11:05 UTC
Fixed in bcde973cca39. You can now use the rhtml.doctype property for specifying the fallback dtd in ruby/rails 
projects. For example (in nbproject/project.properties):

rhtml.doctype=-//W3C//DTD HTML 4.01//EN

In ruby/rails projects it defaults to -//W3C//DTD XHTML 1.0 Strict//EN

Comment 18 fjan11 2009-09-24 09:17:53 UTC
Excellent thanks!
Comment 19 Quality Engineering 2009-09-26 21:11:37 UTC
Integrated into 'main-golden', will be available in build *200909251401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/bcde973cca39
User: Erno Mononen <emononen@netbeans.org>
Log: #165475: "fieldset" tag in rhtml incorrectly marked
Comment 20 fjan11 2010-11-08 20:39:58 UTC
This was fixed in 6.7 but in 7.0M2 the problem has reappeared.
Comment 21 fjan11 2010-11-19 10:35:59 UTC
In 7.0 Beta this has now changed to an ability to set the doctype yourself