Extend JS MOC objects
This commit is contained in:
parent
a7e1e4cc64
commit
f657ac5816
@ -16,7 +16,9 @@ VERSION = "0.5.0 (devel)"
|
|||||||
# __pragma__ ('skip')
|
# __pragma__ ('skip')
|
||||||
# MOC objects to satisfy statical checker and imports in unit tests
|
# MOC objects to satisfy statical checker and imports in unit tests
|
||||||
js_undefined = 0
|
js_undefined = 0
|
||||||
class classList():
|
|
||||||
|
|
||||||
|
class classList:
|
||||||
|
|
||||||
def add(self, *args, **kwargs):
|
def add(self, *args, **kwargs):
|
||||||
pass
|
pass
|
||||||
@ -25,26 +27,37 @@ class classList():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class document():
|
class document:
|
||||||
|
|
||||||
def querySelectorAll(self, *args, **kwargs):
|
def querySelectorAll(self, *args, **kwargs):
|
||||||
return [element()]
|
return [Node()]
|
||||||
|
|
||||||
def getElementById(self, *arg, **kwargs):
|
def getElementById(self, *arg, **kwargs):
|
||||||
return element()
|
return Node()
|
||||||
|
|
||||||
def createElementNS(self, *arg, **kwargs):
|
def createElementNS(self, *arg, **kwargs):
|
||||||
return element()
|
return Node()
|
||||||
|
|
||||||
def createElement(self, *args, **kwargs):
|
def createElement(self, *args, **kwargs):
|
||||||
return element()
|
return Node()
|
||||||
|
|
||||||
|
|
||||||
class element():
|
class Node:
|
||||||
|
|
||||||
firstChild = []
|
|
||||||
classList = classList()
|
classList = classList()
|
||||||
offsetWidth = 0
|
offsetWidth = 0
|
||||||
|
textContent = ""
|
||||||
|
|
||||||
|
def __init__(self, nr_children=1):
|
||||||
|
self.nr_children = nr_children
|
||||||
|
|
||||||
|
@property
|
||||||
|
def firstChild(self):
|
||||||
|
if self.nr_children:
|
||||||
|
self.nr_children -= 1
|
||||||
|
return Node(self.nr_children)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
def removeChild(self, *args, **kwargs):
|
def removeChild(self, *args, **kwargs):
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user