Paul
Paul

Reputation: 1383

HTML5 script tag

I have just seen the following in my book Programming in HTML5 with javascript and css3:

<script ref="/file.js"></script>

I have never seen the ref attribute tag before in the script tag, is this valid?

Edit:

It is a typo in the book found http://www.oreilly.com/catalog/errata.csp?isbn=0790145371133

Upvotes: 2

Views: 212

Answers (2)

Mike Barwick
Mike Barwick

Reputation: 5367

Negative, ref is not a permitted attribute as per: http://www.w3.org/TR/html-markup/script.html

The script element enables dynamic script and data blocks to be included in documents. Permitted attributes: global attributes & src & defer & async & type & charset & language.

via w3

Note, "referencing" files in <script /> tags must be done via the src method, which specifies the address of the external script to use.

I think the author meant to use src as below:

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

Upvotes: 3

rcandrzej
rcandrzej

Reputation: 21

It's a typo. The most likely candidate is the src attribute.

See https://developer.mozilla.org/en/docs/Web/HTML/Element/script

Upvotes: 1

Related Questions