diff --git a/README.md b/README.md index 77b60dd0..3698b941 100755 --- a/README.md +++ b/README.md @@ -227,15 +227,15 @@ or it will complain the params are in the wrong order. You have to instead put c div( p("Some content"), _class="container") -which is annoying when a div gets long. You can get around this several ways. +which is annoying when a div gets long. -With 'innerHTML' which is available on every Node: +You can get around this by using 'html' which is available on every Element: - div( _class="container" ).innerHTML("Some content") +div( _class="container" ).html("Some content") -With 'html' which is available on every Node: +This is NOT like jQuery html func that returns just the inner content. use innerHTML for that. - div( _class="container" ).html("Some content") +It is used specifically for rendering. ### Common Errors diff --git a/domonic/__init__.py b/domonic/__init__.py index 0a824f69..99a9145f 100755 --- a/domonic/__init__.py +++ b/domonic/__init__.py @@ -8,7 +8,7 @@ - Call Terminal commands using python 3 (this one requires a nix machine) """ -__version__ = "0.1.0" +__version__ = "0.1.1" __license__ = 'MIT' # from typing import * diff --git a/domonic/dom.py b/domonic/dom.py index f1a44b05..048d8a47 100644 --- a/domonic/dom.py +++ b/domonic/dom.py @@ -265,13 +265,25 @@ def attributes(self) -> List: ''' Returns a List of an element's attributes''' return self.attributes - def innerHTML(self, *args) -> str: + @property + def innerHTML(self) -> str: ''' Sets or returns the content of an element''' - self.args = args + # self.args = args + return self.content + + @innerHTML.setter + def innerHTML(self, value): + + if value is not None: + self.args = (value,) # TODO - will need the parser to work for this to work properly. for now shove all on first content node + return self.content - def html(self, *args) -> str: - return self.innerHTML(*args) + + def html(self, *args) -> str : + self.args = args + return self + def blur(self): '''Removes focus from an element''' diff --git a/setup.py b/setup.py index 61124438..1a8cb35c 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name = 'domonic', - version = '0.1.0', + version = '0.1.1', author="@byteface", author_email="byteface@gmail.com", license="MIT", diff --git a/tests/test_dom.py b/tests/test_dom.py index b5ef5bb3..4aaf3b36 100644 --- a/tests/test_dom.py +++ b/tests/test_dom.py @@ -22,10 +22,9 @@ def test_dom(self): self.assertEqual(str(sometag), '