Changeset View
Changeset View
Standalone View
Standalone View
src/script/data/libraries/emmet/lib.js
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 5425 Lines • ▼ Show 20 Line(s) | 5346 | return { | |||
---|---|---|---|---|---|
5426 | 5426 | | |||
5427 | /** | 5427 | /** | ||
5428 | * Gets image size from image byte stream. | 5428 | * Gets image size from image byte stream. | ||
5429 | * @author http://romeda.org/rePublish/ | 5429 | * @author http://romeda.org/rePublish/ | ||
5430 | * @param {String} stream Image byte stream (use <code>IEmmetFile.read()</code>) | 5430 | * @param {String} stream Image byte stream (use <code>IEmmetFile.read()</code>) | ||
5431 | * @return {Object} Object with <code>width</code> and <code>height</code> properties | 5431 | * @return {Object} Object with <code>width</code> and <code>height</code> properties | ||
5432 | */ | 5432 | */ | ||
5433 | getImageSize: function(stream) { | 5433 | getImageSize: function(stream) { | ||
5434 | var pngMagicNum = "\211PNG\r\n\032\n", | 5434 | var pngMagicNum = "\\211PNG\r\n\\032\n", | ||
carewolf: Is that even valid JS? Shouldn\t it be \xHH with hexidecimal? | |||||
Being a js-noob, I did some searchin the net and it seems to me that \211 is supposed to be octal sequence. On https://stackoverflow.com/questions/21071921 it is said that octal sequences are optional in the standard... But indeed I assume this should work. dhaumann: Being a js-noob, I did some searchin the net and it seems to me that \211 is supposed to be… | |||||
https://mathiasbynens.be/notes/javascript-escapes might also be interesting for more background. Maybe the octal notation was deprecated as well... So best would be to fix emmet upstream. dhaumann: https://mathiasbynens.be/notes/javascript-escapes might also be interesting for more background. | |||||
5435 | jpgMagicNum = "\377\330", | 5435 | jpgMagicNum = "\\377\\330", | ||
5436 | gifMagicNum = "GIF8", | 5436 | gifMagicNum = "GIF8", | ||
5437 | pos = 0, | 5437 | pos = 0, | ||
5438 | nextByte = function() { | 5438 | nextByte = function() { | ||
5439 | return stream.charCodeAt(pos++); | 5439 | return stream.charCodeAt(pos++); | ||
5440 | }; | 5440 | }; | ||
5441 | 5441 | | |||
5442 | if (stream.substr(0, 8) === pngMagicNum) { | 5442 | if (stream.substr(0, 8) === pngMagicNum) { | ||
5443 | // PNG. Easy peasy. | 5443 | // PNG. Easy peasy. | ||
▲ Show 20 Lines • Show All 8320 Lines • Show Last 20 Lines |
Is that even valid JS? Shouldn\t it be \xHH with hexidecimal?