|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
660 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 | /**
|
|---|
| 3 | * Can unquote attribute detection from mothereff.in
|
|---|
| 4 | * Copyright Mathias Bynens <https://mathiasbynens.be/>
|
|---|
| 5 | * https://github.com/mathiasbynens/mothereff.in
|
|---|
| 6 | */
|
|---|
| 7 | const escapes = /\\([0-9A-Fa-f]{1,6})[ \t\n\f\r]?/g;
|
|---|
| 8 | const range =
|
|---|
| 9 | // eslint-disable-next-line no-control-regex
|
|---|
| 10 | /[\u0000-\u002c\u002e\u002f\u003A-\u0040\u005B-\u005E\u0060\u007B-\u009f]/;
|
|---|
| 11 |
|
|---|
| 12 | /**
|
|---|
| 13 | * @param {string} value
|
|---|
| 14 | * @return {boolean}
|
|---|
| 15 | */
|
|---|
| 16 | module.exports = function canUnquote(value) {
|
|---|
| 17 | if (value === '-' || value === '') {
|
|---|
| 18 | return false;
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | value = value.replace(escapes, 'a').replace(/\\./g, 'a');
|
|---|
| 22 |
|
|---|
| 23 | return !(range.test(value) || /^(?:-?\d|--)/.test(value));
|
|---|
| 24 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.