Why don't self-closing script elements work?

0 votes

What is the reason browsers do not correctly recognize:

<script src="foobar.js" /> <!-- self-closing script element -->

Only this is recognized:

<script src="foobar.js"></script>

Does this break the concept of XHTML support?

Apr 23 in HTML by kartik
• 11,890 points
18 views

1 answer to this question.

0 votes

Hello @kartik,

That's because SCRIPT TAG is not a VOID ELEMENT.

In an HTML Document - VOID ELEMENTS do not need a "closing tag" at all!

In xhtml, everything is Generic, therefore they all need termination e.g. a "closing tag"; Including br, a simple line-break, as <br></br> or its shorthand <br />.

However, a Script Element is never a void or a parametric Element, because script tag before anything else, is a Browser Instruction, not a Data Description declaration.

Hope this works!!

Thank You!!

answered Apr 23 by Niroj
• 23,950 points

Related Questions In HTML

0 votes
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18 in Laravel by Niroj
• 23,950 points
478 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18 in Laravel by Niroj
• 23,950 points
64 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23 in Laravel by Niroj
• 23,950 points
68 views
0 votes
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23 in Laravel by Niroj
• 23,950 points
174 views
0 votes
1 answer

Why we don't use Selenium IDE?

Selenium IDE is a Mozilla Firefox plugin, which ...READ MORE

answered May 3, 2018 in Selenium by Meci Matt
• 9,460 points
617 views
+6 votes
3 answers

Why don't we consider Git as a Blockchain?

Blockchain is not just any chain of any blocks. Blockchain is when there ...READ MORE

answered Sep 7, 2018 in Blockchain by Rowski
426 views
+1 vote
1 answer

Why does x,y = zip(*zip(a,b)) work in Python?

I'm extremely new to Python so this ...READ MORE

answered Aug 23, 2018 in Python by Priyaj
• 57,530 points
160 views
0 votes
1 answer

Why should we use "distinct" keyword in pig script?

Hey, The "distinct" statement is very simple. It ...READ MORE

answered May 3, 2019 in Big Data Hadoop by Gitika
• 29,690 points
86 views
–1 vote
1 answer
0 votes
1 answer

“cd” doesn't work in my shell script

One way to get around this is ...READ MORE

answered May 23, 2019 in Linux Administration by Shubham
• 13,380 points
153 views