Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Fixed custom_splash_screen bugs #62

Merged
merged 2 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,17 @@ $options = [
// Default: blank array
'ignore_lazyload_texts' => [],

// Do not lazy-load for tags containing
// one of these CSS class names.
// Do not lazy-load for tags containing one of these CSS class names.
// Default: blank array
'ignore_lazyload_css_class' => [],

// Do not lazy-load for tags containing
// one of these CSS selectors.
// Do not lazy-load for tags matching one of these CSS selectors.
// See: https://www.w3schools.com/cssref/css_selectors.asp
// Default: blank array
'ignore_lazyload_css_selectors' => [],
'ignore_lazyload_css_selectors' => [
// 'header img',
// 'img#logo',
],
];

// Create a Defer object
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "Mai Nhut Tan <[email protected]>",
"license": "MIT",
"dependencies": {
"@shinsenter/defer.js": "^2.4.0"
"@shinsenter/defer.js": "^2.4.1"
},
"scripts": {
"cleanup": "rm -rf ./node_modules package-lock.json",
Expand Down
2 changes: 1 addition & 1 deletion public/lib/defer.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/lib/defer_plus.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 23 additions & 3 deletions src/Elements/CommonDomTraits.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public function precede($input)

if ($this->parentNode instanceof DOMNode) {
foreach ($input as $node) {
$this->parentNode->insertBefore($node, $this);
$this->parentNode->insertBefore($this->_safeNode($node), $this);
}
}
}
Expand All @@ -211,6 +211,8 @@ public function follow($input)

if ($this->parentNode instanceof DOMNode) {
foreach ($input as $node) {
$node = $this->_safeNode($node);

if (is_null($this->nextSibling)) {
$this->parentNode->appendChild($node);
} else {
Expand All @@ -236,7 +238,7 @@ public function prependWith($input)
}

foreach ($input as $node) {
$this->insertBefore($node, $this->firstChild);
$this->insertBefore($this->_safeNode($node), $this->firstChild);
}
}

Expand All @@ -256,7 +258,7 @@ public function appendWith($input)
}

foreach ($input as $node) {
$this->appendChild($node);
$this->appendChild($this->_safeNode($node));
}
}

Expand Down Expand Up @@ -310,4 +312,22 @@ private function _pushAttrValue($name, $value, $addValue = false)
}
}
}

/**
* @internal
*
* @param \DOMNode|string $input
* @return \DOMNode
*/
private function _safeNode($input)
{
if ($input instanceof DOMNode) {
return $input;
}

$fragment = $this->document()->createDocumentFragment();
$fragment->appendXML($input);

return $fragment;
}
}
11 changes: 6 additions & 5 deletions src/Helpers/DeferOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,16 +376,17 @@ public function getWellKnown3rd($useCache = true)
* // Default: blank array
* 'ignore_lazyload_texts' => [],
*
* // Do not lazy-load for tags containing
* // one of these CSS class names.
* // Do not lazy-load for tags containing one of these CSS class names.
* // Default: blank array
* 'ignore_lazyload_css_class' => [],
*
* // Do not lazy-load for tags containing
* // one of these CSS selectors.
* // Do not lazy-load for tags matching one of these CSS selectors.
* // See: https://www.w3schools.com/cssref/css_selectors.asp
* // Default: blank array
* 'ignore_lazyload_css_selectors' => [],
* 'ignore_lazyload_css_selectors' => [
* // 'header img',
* // 'img#logo',
* ],
*
* @since 2.0.0
* @return array
Expand Down