From a80cb8942a0d95b6b1d9ed5733bd1f706aa31a46 Mon Sep 17 00:00:00 2001 From: Sascha Peilicke Date: Thu, 8 Aug 2013 10:53:46 +0200 Subject: [PATCH] Allow camel-case DOM elements defined in SVG-1.1 The SVG standard defines several DOM elements in camel-case (namely textPath, altGlyph, altGlyphDef, altGlyphItem and glyphRef). Even though most browser also accept lower-case, the lexer should take this into account. --- lesscpy/lessc/lexer.py | 2 +- lesscpy/test/css/svg.css | 9 +++++++++ lesscpy/test/css/svg.min.css | 3 +++ lesscpy/test/less/svg.less | 3 +-- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lesscpy/lessc/lexer.py b/lesscpy/lessc/lexer.py index e03d86a..d6ad3f1 100644 --- a/lesscpy/lessc/lexer.py +++ b/lesscpy/lessc/lexer.py @@ -129,7 +129,7 @@ class LessLexer: elif v in css.propertys: t.type = 'css_property' t.value = t.value.strip() - elif v.lower() in dom.html: + elif v in dom.html or v.lower() in dom.html: t.type = 'css_dom' elif c == '@': v = v.lower() diff --git a/lesscpy/test/css/svg.css b/lesscpy/test/css/svg.css index afabf9d..398ecea 100644 --- a/lesscpy/test/css/svg.css +++ b/lesscpy/test/css/svg.css @@ -51,3 +51,12 @@ tspan { text tspan { font-weight: bold; } +textPath { + font-weight: bold; +} +text textPath { + font-weight: bold; +} +svg text textPath { + font-weight: bold; +} diff --git a/lesscpy/test/css/svg.min.css b/lesscpy/test/css/svg.min.css index 6f96b1b..c79a416 100644 --- a/lesscpy/test/css/svg.min.css +++ b/lesscpy/test/css/svg.min.css @@ -13,3 +13,6 @@ tref{font-weight:bold;} text tref{font-weight:bold;} tspan{font-weight:bold;} text tspan{font-weight:bold;} +textPath{font-weight:bold;} +text textPath{font-weight:bold;} +svg text textPath{font-weight:bold;} diff --git a/lesscpy/test/less/svg.less b/lesscpy/test/less/svg.less index fe1443d..95fe8f6 100644 --- a/lesscpy/test/less/svg.less +++ b/lesscpy/test/less/svg.less @@ -33,7 +33,6 @@ tref { font-weight: bold; } text tref { font-weight: bold; } tspan { font-weight: bold; } text tspan { font-weight: bold; } -/* NOTE(saschpe): TODO textPath { font-weight: bold; } text textPath { font-weight: bold; } -svg text textPath { font-weight: bold; } */ +svg text textPath { font-weight: bold; }