Dreamweaver rewriting valid code as camelCase

I’ve been using Dreamweaver for years. One thing that has always bothered me is that it wants to change my lowercase JavaScript event attributes to camelCase, but it only does this after I close the file. So when I wrote the code, it was valid XHTML 1.0 Strict, but after I saved the file, it no longer was. Dreamweaver was messing up my validation and it was making me furious.

So, if I have typed

<body onload="init()">

Once I’ve closed the file, it’s changed to

<body onLoad="init()">

It will do this for all the tags: onload, onblur, onfocus, etc…

I’ve tried setting my default document type, the validation fallback, everything I could find to XHTML 1.0 Strict, which requires lowercase attributes, but Dreamweaver isn’t smart enough to realize that I mean for this to apply to all of my files, even .php includes.

Finally, I’d had enough and started looking for a solution. I found two different ways of getting this done.

First method: click on Edit -> Preferences -> Code Format. Change “Default tag case” to lowercase, “Default attribute case” to lowercase=’value’, and in “Override case of”, place checkmarks next to Tags and Attributes.

You can also modify each of these attributes in the Tag Library Editor.

Second method: click on Edit -> Preferences -> Code Hints, and under the Menus area, click on the Tag Library Editor link.

A Tag Library Editor window will open. If you wanted to change the body’s onload attribute, for example, you would expand the HTML folder, then the body folder. Highlight onLoad and in the “Attribute case:” menu, select Lowercase, then click “Set default”.

At long last, valid XHTML code from Dreamweaver, even if I shouldn’t be using body onload and inline event handlers in the first place.

2 thoughts on “Dreamweaver rewriting valid code as camelCase

  1. Emma

    Thank you so much for this info, it solved my problem! I spent hours searching for info about this Dreamweaver “bug”, it turns out it was just a matter of changing a setting. I was about to give up on DW and start using a different editor. Gracias!

Leave a Reply

Your email address will not be published. Required fields are marked *