From:  "Fitzgerald, Nick" <>
Date:  19 Apr 2013 06:07:37 Hong Kong Time

Re: Change sourceMappingURL comment syntax to avoid IE JS conditional compilation issues


On 4/18/13 2:02 PM, Joseph Pecoraro wrote:
> On Monday, April 15, 2013 8:02:19 AM UTC-7, John Lenz wrote:
>> As the last line of a file it, do it really cause any problems with IE's
>> conditional code?  Can you give an example where it does?
> The last line condition in the spec doesn't seem to match the current usage and implementations I've seen.
> The spec currently says:
> [[[
>      The generated code may include a line at the end of the source, with the following form: ...
> ]]]
> Current usage and implementations:
> 1. User, the case listed above, for example. Their jquery.min.js references a sourceMappingURL at the 2nd line of the script, not the last line: [1]
> /*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. |
> //@
> */
> 2. Browser implementations
> 	- WebKit / Blink ignore the last line constraint within JavaScript and search for the first directive [2]. In CSS however, they search the last line for a "/*@ sourceMappingURL ..." comment. [3].
> 	- Gecko ignores the last line constraint as well within JavaScript. It has a test for if the directive appears multiple times it takes the last one. [4][5]
> 3. What of the future?
> 	If there is another "//@ property" suggested to continue this trend, would they both also compete for the last line? The "last line" declaration is brittle for future expansion.
> Proposals:
> - I'd like to see the "last line" condition in the spec be dropped. If anything I'd like to see a "beginning of line" condition be added for sourceMappingURL. I haven't seen sourceMappingURL comments be used or generated not at the start of a line, and that seems reasonable to me.

+1 for dropping the last line clause, indifferent about requiring the 
pragma to be at the beginning of the line.

> - I'd also like to see clarification on which sourceMappingURL directive should be used (the first or last) directive, if there are multiple. I'd expect the last. This is an edge case though.

+1 for the last directive.

Ideally, there would also be warnings in the console if there are

> Although this isn't what this thread started discussing, I think it was related. Sorry if this derails discussion of the original issue.
>> The format was chosen to match Firebug's "SourceURL" annotation for naming
>> eval'd code (which Chrome also supports).
> I don't think my "beginning of line" suggestion should apply to "sourceURL". I'm guessing that would conflict with existing usage anyways.

I'm guessing you are right, and this is out of scope for this list.