Open Bug 164685 Opened 23 years ago Updated 1 year ago

Don't add ="" to custom boolean attributes

Categories

(Core :: DOM: Serializers, defect)

PowerPC
macOS
defect

Tracking

()

People

(Reporter: chris.weaver, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: testcase)

Attachments

(1 file)

We use Maxum's NetCloak Pro [ http://www.maxum.com/NetCloak/ ] on our webserver (G4 tower, OS X Server Unlimited running Apache). To call up a server-side macro from NetCloak's macro file, one uses a <macro> tag as such: <macro stylesheet> In most other editors I use or have tried (DreamWeaver, PageSpinner, GoLive, Freeway) these <macro> tags are ignored, since they are interpreted server-side. In Mozilla's Composer, however, these tags (from a standard template we distribute widely) are converted as below: <macro stylesheet=""></macro> Obviously, NetCloak doesn't like this syntax and fails to use the <macro> correctly. Is there any way to turn off Mozilla's syntax checking/rearrangement, per tag? Thanks.
Confirmed using FizzillaCFM/1.1-final on 10.1.5. Reassigning to Editor: Core.
Assignee: syd → kin
Status: UNCONFIRMED → NEW
Component: Editor: Composer → Editor: Core
Ever confirmed: true
Summary: Using NetCloak Macro tags in Composer → Don't add ="" to custom boolean attributes
Attached file Testcase
Composer adds ="" to the stylesheet boolean attribute in this testcase.
Keywords: testcase
glazman, are we doing this internally? Or is this happening in the serializer?
Assignee: kin → glazman
The parser handles boolean attributes in shorthand form only in the html namespace for the time being. Fixing this bug would require adding to the parser the ability to declare an attribute as boolean whatever is namespace, and the implementation boolean attributes. Since boolean attributes in shorthand form don't exist in XML, and since user-defined elements/attributes are not supposed to be in a document at browsing time, I am not sure we're going to fix this... Kin, what do you think ?
I thought the appropriate thing to output for booleans was something like foo="foo"; this sounds like a duplicate bug but perhaps I misunderstand?
QA Contact: sujay → editor

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: daniel → nobody

I think that it's no problem to add ="", but I don't find any standards about serialization of boolean attributes. Anyway, this must be handled by serializer's staff.

Component: DOM: Editor → DOM: Serializers
Severity: normal → S3

Hello everyone,

I think that it's no problem to add =""

It is in fact a problem in some cases. For instance, this code:

<option selected>blah</option>

Will then get modified, when saving the page to disk, to:

<option selected="selected">blah</option>

However, if you're using JavaScript to save the HTML document (instead of using Ctrl+S), it might end up as selected="".

But if you're trying to run an HTML validator such as html-validate, with attribute-boolean-style rule, you'll get an error because selected is a boolean attribute and shouldn't have an empty string as value (in the context of the rule you chose to have).

To be precise, the spec allows for these 3 variations (naked, empty string, or attribute name). The problem here is the difference between what the server is actually sending / code shown in View source code (correctly shown without ="") and the code found after saving the html file on disk, which is different depending on how it was saved, and in no case similar to the "real" HTML sent by the server.

I understand this bug report was opened 22 years ago. Since then, spec has evolved, and I wish to propose that boolean attributes are allowed to stay "naked" in all cases. The issue here being about the browser allowing the user to access the exact same code that was sent by the server.

For reference: https://html.spec.whatwg.org/#boolean-attributes

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: