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, 2020 in HTML by kartik
• 37,490 points
130 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, 2020 by Niroj
• 82,680 points

Related Questions In HTML

+1 vote
1 answer

How to make anchor tag with routing using Laravel?

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

answered Mar 18, 2020 in Laravel by Niroj
• 82,680 points
6,672 views
0 votes
1 answer

What is redirection in Laravel?

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

answered Mar 18, 2020 in Laravel by Niroj
• 82,680 points
777 views
0 votes
1 answer

How to install Laravel via composer?

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

answered Mar 23, 2020 in Laravel by Niroj
• 82,680 points
582 views
+1 vote
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, 2020 in Laravel by Niroj
• 82,680 points
7,083 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
965 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
943 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
• 58,100 points
386 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
• 65,870 points
179 views
–1 vote
1 answer

Why Flash testing is different and difficult than testing other Web Elements?

Hi Himanshu, Flash Testing is testing type ...READ MORE

answered May 23, 2019 in Selenium by Ritesh
113 views
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,480 points
577 views