File tree Expand file tree Collapse file tree 4 files changed +55
-7
lines changed Expand file tree Collapse file tree 4 files changed +55
-7
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ public function prop_get_value() {
124
124
}
125
125
126
126
if (in_array (strtoupper ($ this ->tagName ), self ::VALUE_ELEMENTS )) {
127
- return $ this ->nodeValue ;
127
+ return $ this ->getAttribute ( " value " ) ;
128
128
}
129
129
130
130
return null ;
@@ -136,7 +136,7 @@ public function prop_set_value(string $newValue) {
136
136
return $ this ->$ methodName ($ newValue );
137
137
}
138
138
139
- $ this ->nodeValue = $ newValue ;
139
+ $ this ->setAttribute ( " value " , $ newValue) ;
140
140
}
141
141
142
142
public function prop_get_id ():?string {
Original file line number Diff line number Diff line change @@ -499,4 +499,15 @@ public function testAttributeValueSelection() {
499
499
self ::assertSame ($ input1 , $ input2 );
500
500
self ::assertEquals ("Scarlett " , $ input1 ->value );
501
501
}
502
+
503
+ public function testOptionValueGetSet () {
504
+ $ document = new HTMLDocument (Helper::HTML_SELECTS );
505
+ foreach ($ document ->querySelectorAll ("[name=from] option " ) as $ fromOption ) {
506
+ self ::assertIsNumeric ($ fromOption ->value );
507
+ }
508
+
509
+ foreach ($ document ->querySelectorAll ("[name=to] option " ) as $ toOption ) {
510
+ self ::assertIsNumeric ($ toOption ->value );
511
+ }
512
+ }
502
513
}
Original file line number Diff line number Diff line change @@ -370,6 +370,35 @@ class Helper {
370
370
<input name="dob" type="date" />
371
371
</label>
372
372
</form>
373
+ HTML ;
374
+
375
+ const HTML_SELECTS = <<<HTML
376
+ <!doctype html>
377
+ <form>
378
+ <label>
379
+ <span>From:</span>
380
+ <select name="from">
381
+ <option value="0">Zero</option>
382
+ <option value="1">One</option>
383
+ <option value="2">Two</option>
384
+ <option value="3">Three</option>
385
+ <option value="4">Four</option>
386
+ <option value="5">Five</option>
387
+ </select>
388
+ </label>
389
+
390
+ <label>
391
+ <span>To:</span>
392
+ <select name="to">
393
+ <option value="5">Five</option>
394
+ <option value="6">Six</option>
395
+ <option value="7">Seven</option>
396
+ <option value="8">Eight</option>
397
+ <option value="9">Nine</option>
398
+ <option value="10">Ten</option>
399
+ </select>
400
+ </label>
401
+ </form>
373
402
HTML ;
374
403
375
404
}
You can’t perform that action at this time.
0 commit comments