Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep JSPX from creating self closing tags (<div></div> != <div/>)

JSPX has the lovely side effect of turning:

<div class="magic"></div>

Into:

<div class="magic" />

For many browsers this causes pandemonium and mayhem with layout even though it is valid XHTML. Consequently I have resorted to using a groovy script to find all possible bad HTML with the following regex:

def m = html =~ /<(\w+)[^>]*?><\/(\w+)>/
def bad = m.findAll { it[1] == it[2]  };

Is there way to have the JSPX XML processor not to self close tags?

like image 428
Adam Gent Avatar asked Oct 11 '10 15:10

Adam Gent


People also ask

Is Div A self closing tag?

All tags must be closed, either with the self-closing format or with a corresponding closing tag ( </MyComponent> ). Note: Every React component can be self-closing: <div /> . <div></div> is also an equivalent.

Which tags are self closing in HTML?

↑ The full list of valid self-closing tags in HTML5 is: area, base, br, col, embed, hr, img, input, keygen, link, meta, param, source, track, and wbr.

How do you create a closing tag in HTML?

An opening tag begins a section of page content, and a closing tag ends it. For example, to markup a section of text as a paragraph, you would open the paragraph with an opening paragraph tag <p> and close it with a closing paragraph tag </p> (closing tags always proceed the element with a /).


1 Answers

I've been using <div><jsp:text/></div>

like image 126
Glenn Lane Avatar answered Oct 22 '22 15:10

Glenn Lane