зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1222291 - change getRuleText to handle token-less rules; r=bgrins
This commit is contained in:
Родитель
903b8a7a0e
Коммит
5e926a6a07
|
@ -2084,6 +2084,13 @@ function getRuleText(initialText, line, column) {
|
|||
if (startOffset === undefined) {
|
||||
return {offset: 0, text: ""};
|
||||
}
|
||||
// If the input didn't have any tokens between the braces (e.g.,
|
||||
// "div {}"), then the endOffset won't have been set yet; so account
|
||||
// for that here.
|
||||
if (endOffset === undefined) {
|
||||
endOffset = startOffset;
|
||||
}
|
||||
|
||||
// Note that this approach will preserve comments, despite the fact
|
||||
// that cssTokenizer skips them.
|
||||
return {offset: textOffset + startOffset,
|
||||
|
|
|
@ -100,6 +100,13 @@ const TEST_DATA = [
|
|||
column: 4,
|
||||
expected: {offset: 7, text: "border:1px solid red;content: '}';color:red;"}
|
||||
},
|
||||
{
|
||||
desc: "Rule contains no tokens",
|
||||
input: "div{}",
|
||||
line: 1,
|
||||
column: 1,
|
||||
expected: {offset: 4, text: ""}
|
||||
},
|
||||
];
|
||||
|
||||
function run_test() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче