File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313- Added new option ` depthFirstSearch ` .
1414- Deprecated option ` depthFirstSearch ` and marked for removal in ` 3.0.0 ` .
1515- Added multi class selections support.
16+ - Added case insensitive attribute matching
1617
1718### Changed
1819- Started using a changelog.
Original file line number Diff line number Diff line change @@ -283,6 +283,7 @@ public function getAttributes()
283283 */
284284 public function getAttribute (string $ key )
285285 {
286+ $ key = strtolower ($ key );
286287 if ( ! isset ($ this ->attr [$ key ])) {
287288 return null ;
288289 }
Original file line number Diff line number Diff line change @@ -452,4 +452,24 @@ public function testFindDepthFirstSearch()
452452
453453 $ this ->assertEquals ('<img src="http://example.com/first.jpg" /> ' , (string )$ images [0 ]);
454454 }
455+
456+ public function testCaseInSensitivity ()
457+ {
458+ $ str = "<FooBar Attribute='asdf'>blah</FooBar> " ;
459+ $ dom = new Dom ();
460+ $ dom ->loadStr ($ str );
461+
462+ $ FooBar = $ dom ->find ('FooBar ' );
463+ $ this ->assertEquals ('asdf ' , $ FooBar ->attribute );
464+ }
465+
466+ public function testCaseSensitivity ()
467+ {
468+ $ str = "<FooBar Attribute='asdf'>blah</FooBar> " ;
469+ $ dom = new Dom ();
470+ $ dom ->loadStr ($ str );
471+
472+ $ FooBar = $ dom ->find ('FooBar ' );
473+ $ this ->assertEquals ('asdf ' , $ FooBar ->Attribute );
474+ }
455475}
You can’t perform that action at this time.
0 commit comments