(s: string, i: number, j: number)
| 1976 | } |
| 1977 | |
| 1978 | private attributeValue(s: string, i: number, j: number): string { |
| 1979 | let reference = false |
| 1980 | let whitespace = false |
| 1981 | if (j - i < shortValue) { |
| 1982 | for (let k = i; k < j; k++) { |
| 1983 | const c = s.charCodeAt(k) |
| 1984 | if (c === LT) throw this.syntax("\"<\" is not allowed in attribute values", k) |
| 1985 | if (c === AMPERSAND) reference = true |
| 1986 | else if (c === TAB || c === LF || c === CR) whitespace = true |
| 1987 | } |
| 1988 | if (!reference && !whitespace) return s.slice(i, j) |
| 1989 | } else { |
| 1990 | // A regex search beats the loop above on long values |
| 1991 | const value = s.slice(i, j) |
| 1992 | const special = value.search(attributeSpecial) |
| 1993 | if (special === -1) return value |
| 1994 | const lt = value.indexOf("<", special) |
| 1995 | if (lt !== -1) throw this.syntax("\"<\" is not allowed in attribute values", i + lt) |
| 1996 | reference = value.indexOf("&", special) !== -1 |
| 1997 | whitespace = !reference || attributeWhitespaceChar.test(value) |
| 1998 | } |
| 1999 | const raw = s.slice(i, j) |
| 2000 | return reference ? this.decodeText(raw, i, true, whitespace) : normalizeAttribute(raw) |
| 2001 | } |
| 2002 | |
| 2003 | private endTag(s: string, i: number): number { |
| 2004 | const n = s.length |
no test coverage detected