Skip to main content
Inspiring
May 29, 2023
Answered

How do I stop Dreamweaver from creating self-closing tags, especially for IMG?

  • May 29, 2023
  • 3 replies
  • 1673 views

Dreamweaver creates a self-closing tag when it inserts an image (and maybe elsewhere). How do I stop this outdated behavior? Example:

 

<img src="images/updated.gif" width="87" height="12" alt="Updated"/>

 

That closing slash causes a validation warning. Thanks.


Fred

This topic has been closed for replies.
Correct answer L e n a
quote

Dreamweaver creates a self-closing tag when it inserts an image (and maybe elsewhere). How do I stop this outdated behavior? Example:

<img src="images/updated.gif" width="87" height="12" alt="Updated"/>

That closing slash causes a validation warning. Thanks.

By @Fred Brack

 

Some tasks aren't configurable from preferences, but if you want to remove the IMG ending slash luckly DW's architecture, which dates back to Macromedia, is still fairly flexible.

At least as far as dialog boxes (all in HTML) and commands (all in Javascript) are concerned, so the user interface remains accessible, one can still adapt and modify as one likes.

 

However, don't forget to always make a security copy, just in case...

  1. Quit DW
  2. Open the folder 
    C:\Program Files\Adobe\Adobe Dreamweaver 2021\Configuration\Objects\Common
  3. Locate the file Image.js file (that is where you have to make a backup copy)
  4. Open it with a NotePad++ editor (avoid NotePad, especially not WordPad, etc.)
  5. You should encounter a string of type 
    rtnStr = rtnStr + 'alt="' + '"/>';
  6. Just delete the ending slash
    rtnStr = rtnStr + 'alt="' + '">';
  7. Save and close the file
  8. Restart DW,
  9. Now, when you insert the image from the main menu, the slash should have disappeared in the code

 

3 replies

Community Expert
January 19, 2024
quote

Thanks for sharing this solution, Lena. Do you know the path to images.js on a Mac? (using Dreamweaver 21.3 on Sonoma). I tried looking in library/application support/adobe/Dreamweaver 2021/en_US but can't find it.


By @casidoug7

 

Sorry, I didn't catch your question. In fact, I think @BenPleysier  was telling you about this URL, as many of the paths are often referenced and can provide leads.

In any case, I don't have access to a virtual machine from where I am at the moment, and it's difficult for me to check for myself, but I'd say that if it's a question of application settings, and as @Jon Fritz propose I'd look at :

 

/Applications/Adobe Dreamweaver 2021/Configuration/Objects/Common

 

 

L e n aCommunity ExpertCorrect answer
Community Expert
May 31, 2023
quote

Dreamweaver creates a self-closing tag when it inserts an image (and maybe elsewhere). How do I stop this outdated behavior? Example:

<img src="images/updated.gif" width="87" height="12" alt="Updated"/>

That closing slash causes a validation warning. Thanks.

By @Fred Brack

 

Some tasks aren't configurable from preferences, but if you want to remove the IMG ending slash luckly DW's architecture, which dates back to Macromedia, is still fairly flexible.

At least as far as dialog boxes (all in HTML) and commands (all in Javascript) are concerned, so the user interface remains accessible, one can still adapt and modify as one likes.

 

However, don't forget to always make a security copy, just in case...

  1. Quit DW
  2. Open the folder 
    C:\Program Files\Adobe\Adobe Dreamweaver 2021\Configuration\Objects\Common
  3. Locate the file Image.js file (that is where you have to make a backup copy)
  4. Open it with a NotePad++ editor (avoid NotePad, especially not WordPad, etc.)
  5. You should encounter a string of type 
    rtnStr = rtnStr + 'alt="' + '"/>';
  6. Just delete the ending slash
    rtnStr = rtnStr + 'alt="' + '">';
  7. Save and close the file
  8. Restart DW,
  9. Now, when you insert the image from the main menu, the slash should have disappeared in the code

 

Jon Fritz
Community Expert
Community Expert
May 31, 2023

Thanks, this works perfectly Lena.

Just two minor details I figured I would add...

1. In order to make changes to the Image.js file, the user will need Admin rights on their system
2. Like all of this kind of program file modification, the process needs to be repeated for every new version of DW going forward (if any).

Nancy OShea
Community Expert
Community Expert
May 29, 2023

I'm not losing sleep over this.  😉  

See screenshot from W3C's Validation service.

 

 

Edit HTML.htmlhintrc from Preferences > Linting.

"tag-self-close": false,

 

Nancy O'Shea— Product User & Community Expert
Inspiring
May 30, 2023

Neither am I, Nancy, but it is an outdated practice that should be able to be suppressed. Also, you didn't comment on the rest of the Info message which says "interacts badly ..."!

 

Fred

Nancy OShea
Community Expert
Community Expert
May 30, 2023

@Fred Brack wrote:

Neither am I, Nancy, but it is an outdated practice that should be able to be suppressed. Also, you didn't comment on the rest of the Info message which says "interacts badly ..."!

 

Fred


=======

No need to.  Info only, neither a warning nor an error.  It only interacts badly with "unquoted attributes."   Do you use unquoted image attributes?  I don't.

 

Dreamweaver is not receiving updates except minimal security & compatibility updates.   No new features are being added.  It's been that way since Fall 2020.

 

 

 

Nancy O'Shea— Product User & Community Expert