[whatwg] Script tags with src and content
Tab Atkins Jr.
jackalmage at gmail.com
Thu Aug 4 16:05:05 PDT 2011
On Thu, Aug 4, 2011 at 3:32 PM, Den.Molib <den.molib at gmail.com> wrote:
> I noticed that the html spec doesn't state what should be done with a script
> tag with a non-empty src attribute *and* content inside.
Yes it does. You ignore the contents, and only run the @src script.
Look at <http://www.whatwg.org/specs/web-apps/current-work/complete/scripting-1.html#execute-the-script-block>
-> step 2 -> "If the load was successful" -> step 1. The substep for
"script was loaded from an external source" comes before the "script
was inline" step.
> I realised this when looking at the recommended code for embedding Google+
> [2] (choose a language other than US English). It looks like
>>
>> <script type="text/javascript"
>> src="https://apis.google.com/js/plusone.js">
>> {lang: 'en-GB'}
>> </script>
>
> The script [3] is too minified to follow, but it looks they are using the
> same tag for including the script and embedding parameters, even though they
> are disobeying a must by doing so. Maybe they have a string reason and it's
> the spec what should allow such use. Either way, a clarification in the
> specification looks good.
They're going against a must-level requirement, but the meaning is
easy - they're just using it the inline contents to store data that
the script will grab when it runs.
~TJ
More information about the whatwg
mailing list