From 7db0989b178dbbb17198acccd1f6f84a33db97f8 Mon Sep 17 00:00:00 2001 From: Tim Griesser Date: Sun, 29 Jun 2014 13:15:02 -0400 Subject: [PATCH] Support Namespaces in CJSX Added in https://github.com/facebook/react/pull/760 --- src/parser.coffee | 4 ++-- test/output-testcases.txt | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/parser.coffee b/src/parser.coffee index 8b733dc..789ae22 100644 --- a/src/parser.coffee +++ b/src/parser.coffee @@ -361,7 +361,7 @@ module.exports = class Parser # [3] self closing? OPENING_TAG = /// ^ < - ([-A-Za-z0-9_]+) # tag name (captured) + ([-A-Za-z0-9_\.]+) # tag name (captured) ( (?:\s+[\w-]+ # attr name (?:\s*=\s* # equals and whitespace @@ -380,7 +380,7 @@ OPENING_TAG = /// ^ /// # [1] tag name -CLOSING_TAG = /^<\/([-A-Za-z0-9_]+)[^>]*>/ +CLOSING_TAG = /^<\/([-A-Za-z0-9_\.]+)[^>]*>/ # [0] attr=val # [1] attr diff --git a/test/output-testcases.txt b/test/output-testcases.txt index 85f6352..7d8d05b 100644 --- a/test/output-testcases.txt +++ b/test/output-testcases.txt @@ -501,3 +501,19 @@ tag with {{}} ##expected Person({"name": ({value: item, key, item})}) ##end + +##desc +tag with namespace +##input + +##expected +Something.Tag(null) +##end + +##desc +self closing tag with namespace +##input + +##expected +Something.Tag(null) +##end \ No newline at end of file