This repository was archived by the owner on Oct 1, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ const polyplug = function() {
87
87
if ( Object . keys ( attrs ) . length > 0 ) {
88
88
obj . attributes = attrs ;
89
89
}
90
- if ( obj . tagName === "textarea" ) {
90
+ if ( node . value ) {
91
91
obj . value = node . value ;
92
92
}
93
93
const childNodes = node . childNodes ;
@@ -133,7 +133,7 @@ const polyplug = function() {
133
133
node . setAttribute ( attribute [ 0 ] , attribute [ 1 ] ) ;
134
134
} )
135
135
}
136
- if ( obj . tagName === "textarea" ) {
136
+ if ( obj . value ) {
137
137
node . value = obj . value ;
138
138
}
139
139
break ;
@@ -362,6 +362,8 @@ const polyplug = function() {
362
362
} ) ;
363
363
const send = new CustomEvent ( "polyplugSend" , { detail : detail } ) ;
364
364
document . dispatchEvent ( send ) ;
365
+ e . preventDefault ( ) ;
366
+ return false ;
365
367
}
366
368
REGISTERED_EVENTS [ listener ] = eventHandler ;
367
369
elements . forEach ( function ( element ) {
Original file line number Diff line number Diff line change @@ -367,9 +367,7 @@ def __init__(self, **kwargs):
367
367
super ().__init__ (** kwargs )
368
368
self .tagName = kwargs ["tagName" ]
369
369
self .attributes = Attributes (kwargs .get ("attributes" , {}))
370
- if self .tagName == "textarea" :
371
- # The textarea doesn't have children. Only a text value.
372
- self .value = kwargs .get ("value" , "" )
370
+ self .value = kwargs .get ("value" )
373
371
374
372
def add_child (self , child ):
375
373
"""
@@ -458,8 +456,9 @@ def as_dict(self):
458
456
}
459
457
if self .attributes :
460
458
result ["attributes" ] = self .attributes
461
- if self .tagName == "textarea" :
462
- result ["value" ] = self .value
459
+ value = getattr (self , "value" , None )
460
+ if value :
461
+ result ["value" ] = value
463
462
return result
464
463
465
464
def find (self , selector ):
Original file line number Diff line number Diff line change @@ -71,8 +71,8 @@ def test_wrapper():
71
71
"attributes" : {
72
72
"type" : "text" ,
73
73
"name" : "testInput" ,
74
- "value" : "test" ,
75
74
},
75
+ "value" : "test" ,
76
76
"childNodes" : [],
77
77
},
78
78
{
You can’t perform that action at this time.
0 commit comments