replace JSProperty with js_property

This commit is contained in:
Fabio Pliger
2024-03-26 15:59:18 -05:00
parent 35e7273b69
commit ee9403971f

View File

@@ -10,25 +10,25 @@ class ElementBase(pydom.Element):
# GLOBAL ATTRIBUTES
# These are attribute that all elements have (this list is a subset of the official one)
# We are trying to capture the most used ones
accesskey = JSProperty("accesskey")
autofocus = JSProperty("autofocus")
autocapitalize = JSProperty("autocapitalize")
className = JSProperty("className")
contenteditable = JSProperty("contenteditable")
draggable = JSProperty("draggable")
enterkeyhint = JSProperty("enterkeyhint")
hidden = JSProperty("hidden")
id = JSProperty("id")
lang = JSProperty("lang")
nonce = JSProperty("nonce")
part = JSProperty("part")
popover = JSProperty("popover")
slot = JSProperty("slot")
spellcheck = JSProperty("spellcheck")
tabindex = JSProperty("tabindex")
title = JSProperty("title")
translate = JSProperty("translate")
virtualkeyboardpolicy = JSProperty("virtualkeyboardpolicy")
accesskey = js_property("accesskey")
autofocus = js_property("autofocus")
autocapitalize = js_property("autocapitalize")
className = js_property("className")
contenteditable = js_property("contenteditable")
draggable = js_property("draggable")
enterkeyhint = js_property("enterkeyhint")
hidden = js_property("hidden")
id = js_property("id")
lang = js_property("lang")
nonce = js_property("nonce")
part = js_property("part")
popover = js_property("popover")
slot = js_property("slot")
spellcheck = js_property("spellcheck")
tabindex = js_property("tabindex")
title = js_property("title")
translate = js_property("translate")
virtualkeyboardpolicy = js_property("virtualkeyboardpolicy")
def __init__(self, style=None, **kwargs):
super().__init__(document.createElement(self.tag))
@@ -91,12 +91,12 @@ class a(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a """
tag = "a"
download = JSProperty("download")
href = JSProperty("href")
referrerpolicy = JSProperty("referrerpolicy")
rel = JSProperty("rel")
target = JSProperty("target")
type = JSProperty("type")
download = js_property("download")
href = js_property("href")
referrerpolicy = js_property("referrerpolicy")
rel = js_property("rel")
target = js_property("target")
type = js_property("type")
class abbr(TextElementBase):
@@ -113,15 +113,15 @@ class area(ElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/area """
tag = "area"
alt = JSProperty("alt")
coords = JSProperty("coords")
download = JSProperty("download")
href = JSProperty("href")
ping = JSProperty("ping")
referrerpolicy = JSProperty("referrerpolicy")
rel = JSProperty("rel")
shape = JSProperty("shape")
target = JSProperty("target")
alt = js_property("alt")
coords = js_property("coords")
download = js_property("download")
href = js_property("href")
ping = js_property("ping")
referrerpolicy = js_property("referrerpolicy")
rel = js_property("rel")
shape = js_property("shape")
target = js_property("target")
class article(TextElementBase):
@@ -138,15 +138,15 @@ class audio(ElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio """
tag = "audio"
autoplay = JSProperty("autoplay")
controls = JSProperty("controls")
controlslist = JSProperty("controlslist")
crossorigin = JSProperty("crossorigin")
disableremoteplayback = JSProperty("disableremoteplayback")
loop = JSProperty("loop")
muted = JSProperty("muted")
preload = JSProperty("preload")
src = JSProperty("src")
autoplay = js_property("autoplay")
controls = js_property("controls")
controlslist = js_property("controlslist")
crossorigin = js_property("crossorigin")
disableremoteplayback = js_property("disableremoteplayback")
loop = js_property("loop")
muted = js_property("muted")
preload = js_property("preload")
src = js_property("src")
class b(TextElementBase):
@@ -158,7 +158,7 @@ class blockquote(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote """
tag = "blockquote"
cite = JSProperty("cite")
cite = js_property("cite")
class br(ElementBase):
@@ -170,25 +170,25 @@ class button(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button """
tag = "button"
autofocus = JSProperty("autofocus")
disabled = JSProperty("disabled")
form = JSProperty("form")
formaction = JSProperty("formaction")
formenctype = JSProperty("formenctype")
formmethod = JSProperty("formmethod")
formnovalidate = JSProperty("formnovalidate")
formtarget = JSProperty("formtarget")
name = JSProperty("name")
type = JSProperty("type")
value = JSProperty("value")
autofocus = js_property("autofocus")
disabled = js_property("disabled")
form = js_property("form")
formaction = js_property("formaction")
formenctype = js_property("formenctype")
formmethod = js_property("formmethod")
formnovalidate = js_property("formnovalidate")
formtarget = js_property("formtarget")
name = js_property("name")
type = js_property("type")
value = js_property("value")
class canvas(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas """
tag = "canvas"
height = JSProperty("height")
width = JSProperty("width")
height = js_property("height")
width = js_property("width")
class caption(TextElementBase):
@@ -210,7 +210,7 @@ class data(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/data """
tag = "data"
value = JSProperty("value")
value = js_property("value")
class datalist(TextElementBase):
@@ -227,22 +227,22 @@ class del_(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/del """
tag = "del"
cite = JSProperty("cite")
datetime = JSProperty("datetime")
cite = js_property("cite")
datetime = js_property("datetime")
class details(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details """
tag = "details"
open = JSProperty("open")
open = js_property("open")
class dialog(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog """
tag = "dialog"
open = JSProperty("open")
open = js_property("open")
class div(TextElementBase):
@@ -254,7 +254,7 @@ class dl(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl """
tag = "dl"
value = JSProperty("value")
value = js_property("value")
class dt(TextElementBase):
@@ -271,19 +271,19 @@ class embed(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/embed """
tag = "embed"
height = JSProperty("height")
src = JSProperty("src")
type = JSProperty("type")
width = JSProperty("width")
height = js_property("height")
src = js_property("src")
type = js_property("type")
width = js_property("width")
class fieldset(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset """
tag = "fieldset"
disabled = JSProperty("disabled")
form = JSProperty("form")
name = JSProperty("name")
disabled = js_property("disabled")
form = js_property("form")
name = js_property("name")
class figcaption(TextElementBase):
@@ -305,16 +305,16 @@ class form(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form """
tag = "form"
accept_charset = JSProperty("accept-charset")
action = JSProperty("action")
autocapitalize = JSProperty("autocapitalize")
autocomplete = JSProperty("autocomplete")
enctype = JSProperty("enctype")
name = JSProperty("name")
method = JSProperty("method")
nonvalidate = JSProperty("nonvalidate")
rel = JSProperty("rel")
target = JSProperty("target")
accept_charset = js_property("accept-charset")
action = js_property("action")
autocapitalize = js_property("autocapitalize")
autocomplete = js_property("autocomplete")
enctype = js_property("enctype")
name = js_property("name")
method = js_property("method")
nonvalidate = js_property("nonvalidate")
rel = js_property("rel")
target = js_property("target")
class h1(TextElementBase):
@@ -371,33 +371,33 @@ class iframe(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe """
tag = "iframe"
allow = JSProperty("allow")
allowfullscreen = JSProperty("allowfullscreen")
height = JSProperty("height")
loading = JSProperty("loading")
name = JSProperty("name")
referrerpolicy = JSProperty("referrerpolicy")
sandbox = JSProperty("sandbox")
src = JSProperty("src")
srcdoc = JSProperty("srcdoc")
width = JSProperty("width")
allow = js_property("allow")
allowfullscreen = js_property("allowfullscreen")
height = js_property("height")
loading = js_property("loading")
name = js_property("name")
referrerpolicy = js_property("referrerpolicy")
sandbox = js_property("sandbox")
src = js_property("src")
srcdoc = js_property("srcdoc")
width = js_property("width")
class img(ElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img """
tag = "img"
alt = JSProperty("alt")
crossorigin = JSProperty("crossorigin")
decoding = JSProperty("decoding")
fetchpriority = JSProperty("fetchpriority")
height = JSProperty("height")
ismap = JSProperty("ismap")
loading = JSProperty("loading")
referrerpolicy = JSProperty("referrerpolicy")
sizes = JSProperty("sizes")
src = JSProperty("src")
width = JSProperty("width")
alt = js_property("alt")
crossorigin = js_property("crossorigin")
decoding = js_property("decoding")
fetchpriority = js_property("fetchpriority")
height = js_property("height")
ismap = js_property("ismap")
loading = js_property("loading")
referrerpolicy = js_property("referrerpolicy")
sizes = js_property("sizes")
src = js_property("src")
width = js_property("width")
# NOTE: Input is a reserved keyword in Python, so we use input_ instead
@@ -405,47 +405,47 @@ class input_(ElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input """
tag = "input"
accept = JSProperty("accept")
alt = JSProperty("alt")
autofocus = JSProperty("autofocus")
capture = JSProperty("capture")
checked = JSProperty("checked")
dirname = JSProperty("dirname")
disabled = JSProperty("disabled")
form = JSProperty("form")
formaction = JSProperty("formaction")
formenctype = JSProperty("formenctype")
formmethod = JSProperty("formmethod")
formnovalidate = JSProperty("formnovalidate")
formtarget = JSProperty("formtarget")
height = JSProperty("height")
list = JSProperty("list")
max = JSProperty("max")
maxlength = JSProperty("maxlength")
min = JSProperty("min")
minlength = JSProperty("minlength")
multiple = JSProperty("multiple")
name = JSProperty("name")
pattern = JSProperty("pattern")
placeholder = JSProperty("placeholder")
popovertarget = JSProperty("popovertarget")
popovertargetaction = JSProperty("popovertargetaction")
readonly = JSProperty("readonly")
required = JSProperty("required")
size = JSProperty("size")
src = JSProperty("src")
step = JSProperty("step")
type = JSProperty("type")
value = JSProperty("value")
width = JSProperty("width")
accept = js_property("accept")
alt = js_property("alt")
autofocus = js_property("autofocus")
capture = js_property("capture")
checked = js_property("checked")
dirname = js_property("dirname")
disabled = js_property("disabled")
form = js_property("form")
formaction = js_property("formaction")
formenctype = js_property("formenctype")
formmethod = js_property("formmethod")
formnovalidate = js_property("formnovalidate")
formtarget = js_property("formtarget")
height = js_property("height")
list = js_property("list")
max = js_property("max")
maxlength = js_property("maxlength")
min = js_property("min")
minlength = js_property("minlength")
multiple = js_property("multiple")
name = js_property("name")
pattern = js_property("pattern")
placeholder = js_property("placeholder")
popovertarget = js_property("popovertarget")
popovertargetaction = js_property("popovertargetaction")
readonly = js_property("readonly")
required = js_property("required")
size = js_property("size")
src = js_property("src")
step = js_property("step")
type = js_property("type")
value = js_property("value")
width = js_property("width")
class ins(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ins """
tag = "ins"
cite = JSProperty("cite")
datetime = JSProperty("datetime")
cite = js_property("cite")
datetime = js_property("datetime")
class kbd(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/kbd """
@@ -456,7 +456,7 @@ class label(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label """
tag = "label"
for_ = JSProperty("for")
for_ = js_property("for")
class legend(TextElementBase):
@@ -468,27 +468,27 @@ class li(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li """
tag = "li"
value = JSProperty("value")
value = js_property("value")
class link(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link """
tag = "link"
as_ = JSProperty("as")
crossorigin = JSProperty("crossorigin")
disabled = JSProperty("disabled")
fetchpriority = JSProperty("fetchpriority")
href = JSProperty("href")
imagesizes = JSProperty("imagesizes")
imagesrcset = JSProperty("imagesrcset")
integrity = JSProperty("integrity")
media = JSProperty("media")
rel = JSProperty("rel")
referrerpolicy = JSProperty("referrerpolicy")
sizes = JSProperty("sizes")
title = JSProperty("title")
type = JSProperty("type")
as_ = js_property("as")
crossorigin = js_property("crossorigin")
disabled = js_property("disabled")
fetchpriority = js_property("fetchpriority")
href = js_property("href")
imagesizes = js_property("imagesizes")
imagesrcset = js_property("imagesrcset")
integrity = js_property("integrity")
media = js_property("media")
rel = js_property("rel")
referrerpolicy = js_property("referrerpolicy")
sizes = js_property("sizes")
title = js_property("title")
type = js_property("type")
class main(TextElementBase):
@@ -500,7 +500,7 @@ class map_(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/map """
tag = "map"
name = JSProperty("name")
name = js_property("name")
class mark(TextElementBase):
@@ -517,13 +517,13 @@ class meter(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meter """
tag = "meter"
form = JSProperty("form")
high = JSProperty("high")
low = JSProperty("low")
max = JSProperty("max")
min = JSProperty("min")
optimum = JSProperty("optimum")
value = JSProperty("value")
form = js_property("form")
high = js_property("high")
low = js_property("low")
max = js_property("max")
min = js_property("min")
optimum = js_property("optimum")
value = js_property("value")
class nav(TextElementBase):
@@ -535,29 +535,29 @@ class object_(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object """
tag = "object"
data = JSProperty("data")
form = JSProperty("form")
height = JSProperty("height")
name = JSProperty("name")
type = JSProperty("type")
usemap = JSProperty("usemap")
width = JSProperty("width")
data = js_property("data")
form = js_property("form")
height = js_property("height")
name = js_property("name")
type = js_property("type")
usemap = js_property("usemap")
width = js_property("width")
class ol(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol """
tag = "ol"
reversed = JSProperty("reversed")
start = JSProperty("start")
type = JSProperty("type")
reversed = js_property("reversed")
start = js_property("start")
type = js_property("type")
class optgroup(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/optgroup """
tag = "optgroup"
disabled = JSProperty("disabled")
label = JSProperty("label")
disabled = js_property("disabled")
label = js_property("label")
class option(TextElementBase):
@@ -569,9 +569,9 @@ class output(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/output """
tag = "output"
for_ = JSProperty("for")
form = JSProperty("form")
name = JSProperty("name")
for_ = js_property("for")
form = js_property("form")
name = js_property("name")
class p(TextElementBase):
@@ -593,15 +593,15 @@ class progress(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress """
tag = "progress"
max = JSProperty("max")
value = JSProperty("value")
max = js_property("max")
value = js_property("value")
class q(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/q """
tag = "q"
cite = JSProperty("cite")
cite = js_property("cite")
class s(TextElementBase):
@@ -615,16 +615,16 @@ class script(TextElementBase):
# Let's add async manually since it's a reserved keyword in Python
async_ = js_property("async")
blocking = JSProperty("blocking")
crossorigin = JSProperty("crossorigin")
defer = JSProperty("defer")
fetchpriority = JSProperty("fetchpriority")
integrity = JSProperty("integrity")
nomodule = JSProperty("nomodule")
nonce = JSProperty("nonce")
referrerpolicy = JSProperty("referrerpolicy")
src = JSProperty("src")
type = JSProperty("type")
blocking = js_property("blocking")
crossorigin = js_property("crossorigin")
defer = js_property("defer")
fetchpriority = js_property("fetchpriority")
integrity = js_property("integrity")
nomodule = js_property("nomodule")
nonce = js_property("nonce")
referrerpolicy = js_property("referrerpolicy")
src = js_property("src")
type = js_property("type")
class section(TextElementBase):
@@ -646,11 +646,11 @@ class source(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source """
tag = "source"
media = JSProperty("media")
sizes = JSProperty("sizes")
src = JSProperty("src")
srcset = JSProperty("srcset")
type = JSProperty("type")
media = js_property("media")
sizes = js_property("sizes")
src = js_property("src")
srcset = js_property("srcset")
type = js_property("type")
class span(TextElementBase):
@@ -667,10 +667,10 @@ class style(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style """
tag = "style"
blocking = JSProperty("blocking")
media = JSProperty("media")
nonce = JSProperty("nonce")
title = JSProperty("title")
blocking = js_property("blocking")
media = js_property("media")
nonce = js_property("nonce")
title = js_property("title")
class sub(TextElementBase):
@@ -702,37 +702,37 @@ class td(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td """
tag = "td"
colspan = JSProperty("colspan")
headers = JSProperty("headers")
rowspan = JSProperty("rowspan")
colspan = js_property("colspan")
headers = js_property("headers")
rowspan = js_property("rowspan")
class template(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template """
tag = "template"
shadowrootmode = JSProperty("shadowrootmode")
shadowrootmode = js_property("shadowrootmode")
class textarea(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea """
tag = "textarea"
autocapitalize = JSProperty("autocapitalize")
autocomplete = JSProperty("autocomplete")
autofocus = JSProperty("autofocus")
cols = JSProperty("cols")
dirname = JSProperty("dirname")
disabled = JSProperty("disabled")
form = JSProperty("form")
maxlength = JSProperty("maxlength")
minlength = JSProperty("minlength")
name = JSProperty("name")
placeholder = JSProperty("placeholder")
readonly = JSProperty("readonly")
required = JSProperty("required")
rows = JSProperty("rows")
spellcheck = JSProperty("spellcheck")
wrap = JSProperty("wrap")
autocapitalize = js_property("autocapitalize")
autocomplete = js_property("autocomplete")
autofocus = js_property("autofocus")
cols = js_property("cols")
dirname = js_property("dirname")
disabled = js_property("disabled")
form = js_property("form")
maxlength = js_property("maxlength")
minlength = js_property("minlength")
name = js_property("name")
placeholder = js_property("placeholder")
readonly = js_property("readonly")
required = js_property("required")
rows = js_property("rows")
spellcheck = js_property("spellcheck")
wrap = js_property("wrap")
class tfoot(TextElementBase):
@@ -754,7 +754,7 @@ class time(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time """
tag = "time"
datetime = JSProperty("datetime")
datetime = js_property("datetime")
class title(TextElementBase):
@@ -766,22 +766,22 @@ class tr(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr """
tag = "tr"
abbr = JSProperty("abbr")
colspan = JSProperty("colspan")
headers = JSProperty("headers")
rowspan = JSProperty("rowspan")
scope = JSProperty("scope")
abbr = js_property("abbr")
colspan = js_property("colspan")
headers = js_property("headers")
rowspan = js_property("rowspan")
scope = js_property("scope")
class track(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track """
tag = "track"
default = JSProperty("default")
kind = JSProperty("kind")
label = JSProperty("label")
src = JSProperty("src")
srclang = JSProperty("srclang")
default = js_property("default")
kind = js_property("kind")
label = js_property("label")
src = js_property("src")
srclang = js_property("srclang")
class u(TextElementBase):
@@ -803,19 +803,19 @@ class video(TextElementBase):
""" Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video """
tag = "video"
autoplay = JSProperty("autoplay")
controls = JSProperty("controls")
crossorigin = JSProperty("crossorigin")
disablepictureinpicture = JSProperty("disablepictureinpicture")
disableremoteplayback = JSProperty("disableremoteplayback")
height = JSProperty("height")
loop = JSProperty("loop")
muted = JSProperty("muted")
playsinline = JSProperty("playsinline")
poster = JSProperty("poster")
preload = JSProperty("preload")
src = JSProperty("src")
width = JSProperty("width")
autoplay = js_property("autoplay")
controls = js_property("controls")
crossorigin = js_property("crossorigin")
disablepictureinpicture = js_property("disablepictureinpicture")
disableremoteplayback = js_property("disableremoteplayback")
height = js_property("height")
loop = js_property("loop")
muted = js_property("muted")
playsinline = js_property("playsinline")
poster = js_property("poster")
preload = js_property("preload")
src = js_property("src")
width = js_property("width")
# Custom Elements