-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from alleyinteractive/feature/dom-attributes
Adding DOMDocument property names to the ruleset
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
/** | ||
* DOM Attributes test file. | ||
* | ||
* Ensure that DOMDocument/DOMElement/DOMNode attributes that are camelCase'd | ||
* are not flagged by PHPCS. | ||
* | ||
* @package Alley\WP\Coding_Standards | ||
*/ | ||
|
||
$ai_document = new DOMDocument(); | ||
|
||
// Ensure that DOMDocument properties are allowed. | ||
$ai_document->preserveWhiteSpace = false; | ||
$ai_document->formatOutput = true; | ||
|
||
$ai_document->loadHTML( | ||
file_get_contents( 'https://www.alley.com' ) // phpcs:ignore | ||
); | ||
|
||
// Interact with the DOM document. | ||
$ai_element = $ai_document->getElementById( 'element-id' ); | ||
|
||
// Ensure that DOMElement properties are allowed. | ||
$ai_element->textContent = 'Hello, world!'; | ||
$ai_element->className = 'element-class'; | ||
|
||
$ai_tag = $ai_element->tagName; |