Skip to content

Commit

Permalink
Change . to [^] because /s isn't well supported in JS
Browse files Browse the repository at this point in the history
The `s` flag on the RegExp object informs the engine to treat a
dot character as a class that includes the newline character.
Without it newlines aren't considered in the dot.

Since this flag is new to Javascript and not well supported in
different browsers I have removed it in favor of an explicit class
of characters that _does_ include the newline, namely the open
exclusion of `[^]` which permits all input characters.

Hat-top to @Hywan for finding this.
  • Loading branch information
dmsnell committed Aug 24, 2018
1 parent e47d89c commit 24977fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/parser-rd-trampoline.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let document;
let offset;
let output;
let stack;
const tokenizer = /<!--\s+(?<closer>\/)?wp:(?<namespace>[a-z][a-z0-9_-]*\/)?(?<name>[a-z][a-z0-9_-]*)\s+(?<attrs>{(?:(?!}\s+-->).)+}\s+)?(?<void>\/)?-->/gs;
const tokenizer = /<!--\s+(?<closer>\/)?wp:(?<namespace>[a-z][a-z0-9_-]*\/)?(?<name>[a-z][a-z0-9_-]*)\s+(?<attrs>{(?:(?!}\s+-->)[^])+}\s+)?(?<void>\/)?-->/g;

class Block {
constructor(name, attrs, innerBlocks, innerHTML) {
Expand Down

0 comments on commit 24977fc

Please sign in to comment.