Browse Source

support unquoted URLs as props

Falko Schindler 2 years ago
parent
commit
6ce47af6d6
2 changed files with 2 additions and 1 deletions
  1. 1 1
      nicegui/element.py
  2. 1 0
      tests/test_element.py

+ 1 - 1
nicegui/element.py

@@ -112,7 +112,7 @@ class Element(ABC, Visibility):
             return {}
         lexer = shlex.shlex(text, posix=True)
         lexer.whitespace = ' '
-        lexer.wordchars += '=-.%'
+        lexer.wordchars += '=-.%:/'
         return dict(word.split('=', 1) if '=' in word else (word, True) for word in lexer)
 
     def props(self, add: Optional[str] = None, *, remove: Optional[str] = None):

+ 1 - 0
tests/test_element.py

@@ -43,6 +43,7 @@ def test_props_parsing():
     assert Element._parse_props('one two=1 three="abc def"') == {'one': True, 'two': '1', 'three': 'abc def'}
     assert Element._parse_props('loading percentage=12.5') == {'loading': True, 'percentage': '12.5'}
     assert Element._parse_props('size=50%') == {'size': '50%'}
+    assert Element._parse_props('href=http://192.168.42.100/') == {'href': 'http://192.168.42.100/'}
 
 
 def test_style(screen: Screen):