Skip to content

Commit f8107e5

Browse files
committed
Support reflected attributes of boolean type
Change-Id: I15b008893400e496e8fac2f70d3d0da2c281c159
1 parent 24e96f8 commit f8107e5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+976
-661
lines changed

src/Helper/HTMLAreaElement.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,4 +671,24 @@ public function setRel( string $val ) : void {
671671
$this->setAttribute( 'rel', $val );
672672
}
673673

674+
/**
675+
* @return bool
676+
*/
677+
public function getNoHref() : bool {
678+
'@phan-var Element $this'; /** @var Element $this */
679+
return $this->hasAttribute( 'nohref' );
680+
}
681+
682+
/**
683+
* @param bool $val
684+
*/
685+
public function setNoHref( bool $val ) : void {
686+
'@phan-var Element $this'; /** @var Element $this */
687+
if ( $val ) {
688+
$this->setAttribute( 'nohref', '' );
689+
} else {
690+
$this->removeAttribute( 'nohref' );
691+
}
692+
}
693+
674694
}

src/Helper/HTMLButtonElement.php

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,66 @@ public function __unset( string $name ) : void {
528528
);
529529
}
530530

531+
/**
532+
* @return bool
533+
*/
534+
public function getAutofocus() : bool {
535+
'@phan-var Element $this'; /** @var Element $this */
536+
return $this->hasAttribute( 'autofocus' );
537+
}
538+
539+
/**
540+
* @param bool $val
541+
*/
542+
public function setAutofocus( bool $val ) : void {
543+
'@phan-var Element $this'; /** @var Element $this */
544+
if ( $val ) {
545+
$this->setAttribute( 'autofocus', '' );
546+
} else {
547+
$this->removeAttribute( 'autofocus' );
548+
}
549+
}
550+
551+
/**
552+
* @return bool
553+
*/
554+
public function getDisabled() : bool {
555+
'@phan-var Element $this'; /** @var Element $this */
556+
return $this->hasAttribute( 'disabled' );
557+
}
558+
559+
/**
560+
* @param bool $val
561+
*/
562+
public function setDisabled( bool $val ) : void {
563+
'@phan-var Element $this'; /** @var Element $this */
564+
if ( $val ) {
565+
$this->setAttribute( 'disabled', '' );
566+
} else {
567+
$this->removeAttribute( 'disabled' );
568+
}
569+
}
570+
571+
/**
572+
* @return bool
573+
*/
574+
public function getFormNoValidate() : bool {
575+
'@phan-var Element $this'; /** @var Element $this */
576+
return $this->hasAttribute( 'formnovalidate' );
577+
}
578+
579+
/**
580+
* @param bool $val
581+
*/
582+
public function setFormNoValidate( bool $val ) : void {
583+
'@phan-var Element $this'; /** @var Element $this */
584+
if ( $val ) {
585+
$this->setAttribute( 'formnovalidate', '' );
586+
} else {
587+
$this->removeAttribute( 'formnovalidate' );
588+
}
589+
}
590+
531591
/**
532592
* @return string
533593
*/

src/Helper/HTMLDListElement.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
namespace Wikimedia\IDLeDOM\Helper;
77

8+
use Wikimedia\IDLeDOM\Element;
9+
810
trait HTMLDListElement {
911
/**
1012
* @param string $name
@@ -442,4 +444,24 @@ public function __unset( string $name ) : void {
442444
);
443445
}
444446

447+
/**
448+
* @return bool
449+
*/
450+
public function getCompact() : bool {
451+
'@phan-var Element $this'; /** @var Element $this */
452+
return $this->hasAttribute( 'compact' );
453+
}
454+
455+
/**
456+
* @param bool $val
457+
*/
458+
public function setCompact( bool $val ) : void {
459+
'@phan-var Element $this'; /** @var Element $this */
460+
if ( $val ) {
461+
$this->setAttribute( 'compact', '' );
462+
} else {
463+
$this->removeAttribute( 'compact' );
464+
}
465+
}
466+
445467
}

src/Helper/HTMLDetailsElement.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
namespace Wikimedia\IDLeDOM\Helper;
77

8+
use Wikimedia\IDLeDOM\Element;
9+
810
trait HTMLDetailsElement {
911
/**
1012
* @param string $name
@@ -442,4 +444,24 @@ public function __unset( string $name ) : void {
442444
);
443445
}
444446

447+
/**
448+
* @return bool
449+
*/
450+
public function getOpen() : bool {
451+
'@phan-var Element $this'; /** @var Element $this */
452+
return $this->hasAttribute( 'open' );
453+
}
454+
455+
/**
456+
* @param bool $val
457+
*/
458+
public function setOpen( bool $val ) : void {
459+
'@phan-var Element $this'; /** @var Element $this */
460+
if ( $val ) {
461+
$this->setAttribute( 'open', '' );
462+
} else {
463+
$this->removeAttribute( 'open' );
464+
}
465+
}
466+
445467
}

src/Helper/HTMLDialogElement.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
namespace Wikimedia\IDLeDOM\Helper;
77

8+
use Wikimedia\IDLeDOM\Element;
9+
810
trait HTMLDialogElement {
911
/**
1012
* @param string $name
@@ -442,4 +444,24 @@ public function __unset( string $name ) : void {
442444
);
443445
}
444446

447+
/**
448+
* @return bool
449+
*/
450+
public function getOpen() : bool {
451+
'@phan-var Element $this'; /** @var Element $this */
452+
return $this->hasAttribute( 'open' );
453+
}
454+
455+
/**
456+
* @param bool $val
457+
*/
458+
public function setOpen( bool $val ) : void {
459+
'@phan-var Element $this'; /** @var Element $this */
460+
if ( $val ) {
461+
$this->setAttribute( 'open', '' );
462+
} else {
463+
$this->removeAttribute( 'open' );
464+
}
465+
}
466+
445467
}

src/Helper/HTMLDirectoryElement.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
namespace Wikimedia\IDLeDOM\Helper;
77

8+
use Wikimedia\IDLeDOM\Element;
9+
810
trait HTMLDirectoryElement {
911
/**
1012
* @param string $name
@@ -442,4 +444,24 @@ public function __unset( string $name ) : void {
442444
);
443445
}
444446

447+
/**
448+
* @return bool
449+
*/
450+
public function getCompact() : bool {
451+
'@phan-var Element $this'; /** @var Element $this */
452+
return $this->hasAttribute( 'compact' );
453+
}
454+
455+
/**
456+
* @param bool $val
457+
*/
458+
public function setCompact( bool $val ) : void {
459+
'@phan-var Element $this'; /** @var Element $this */
460+
if ( $val ) {
461+
$this->setAttribute( 'compact', '' );
462+
} else {
463+
$this->removeAttribute( 'compact' );
464+
}
465+
}
466+
445467
}

src/Helper/HTMLElement.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,26 @@ public function setLang( string $val ) : void {
483483
$this->setAttribute( 'lang', $val );
484484
}
485485

486+
/**
487+
* @return bool
488+
*/
489+
public function getHidden() : bool {
490+
'@phan-var Element $this'; /** @var Element $this */
491+
return $this->hasAttribute( 'hidden' );
492+
}
493+
494+
/**
495+
* @param bool $val
496+
*/
497+
public function setHidden( bool $val ) : void {
498+
'@phan-var Element $this'; /** @var Element $this */
499+
if ( $val ) {
500+
$this->setAttribute( 'hidden', '' );
501+
} else {
502+
$this->removeAttribute( 'hidden' );
503+
}
504+
}
505+
486506
/**
487507
* @return string
488508
*/

src/Helper/HTMLFieldSetElement.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,26 @@ public function __unset( string $name ) : void {
489489
);
490490
}
491491

492+
/**
493+
* @return bool
494+
*/
495+
public function getDisabled() : bool {
496+
'@phan-var Element $this'; /** @var Element $this */
497+
return $this->hasAttribute( 'disabled' );
498+
}
499+
500+
/**
501+
* @param bool $val
502+
*/
503+
public function setDisabled( bool $val ) : void {
504+
'@phan-var Element $this'; /** @var Element $this */
505+
if ( $val ) {
506+
$this->setAttribute( 'disabled', '' );
507+
} else {
508+
$this->removeAttribute( 'disabled' );
509+
}
510+
}
511+
492512
/**
493513
* @return string
494514
*/

src/Helper/HTMLFormElement.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,26 @@ public function setName( string $val ) : void {
542542
$this->setAttribute( 'name', $val );
543543
}
544544

545+
/**
546+
* @return bool
547+
*/
548+
public function getNoValidate() : bool {
549+
'@phan-var Element $this'; /** @var Element $this */
550+
return $this->hasAttribute( 'novalidate' );
551+
}
552+
553+
/**
554+
* @param bool $val
555+
*/
556+
public function setNoValidate( bool $val ) : void {
557+
'@phan-var Element $this'; /** @var Element $this */
558+
if ( $val ) {
559+
$this->setAttribute( 'novalidate', '' );
560+
} else {
561+
$this->removeAttribute( 'novalidate' );
562+
}
563+
}
564+
545565
/**
546566
* @return string
547567
*/

src/Helper/HTMLFrameElement.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,26 @@ public function setFrameBorder( string $val ) : void {
561561
$this->setAttribute( 'frameborder', $val );
562562
}
563563

564+
/**
565+
* @return bool
566+
*/
567+
public function getNoResize() : bool {
568+
'@phan-var Element $this'; /** @var Element $this */
569+
return $this->hasAttribute( 'noresize' );
570+
}
571+
572+
/**
573+
* @param bool $val
574+
*/
575+
public function setNoResize( bool $val ) : void {
576+
'@phan-var Element $this'; /** @var Element $this */
577+
if ( $val ) {
578+
$this->setAttribute( 'noresize', '' );
579+
} else {
580+
$this->removeAttribute( 'noresize' );
581+
}
582+
}
583+
564584
/**
565585
* @return string
566586
*/

0 commit comments

Comments
 (0)