@xiee/utils 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/center-img.js +3 -3
- package/package.json +1 -1
package/js/center-img.js
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
tag = tags[i];
|
|
6
6
|
var parent = tag.parentElement;
|
|
7
7
|
// center an image if it is the only element of its parent
|
|
8
|
-
if (parent.
|
|
8
|
+
if (parent.childElementCount === 1) {
|
|
9
9
|
// if there is a link on image, check grandparent
|
|
10
10
|
var parentA = parent.nodeName === 'A';
|
|
11
11
|
if (parentA) {
|
|
12
12
|
parent = parent.parentElement;
|
|
13
|
-
if (parent.
|
|
14
|
-
parent.
|
|
13
|
+
if (parent.childElementCount != 1) continue;
|
|
14
|
+
parent.firstElementChild.style.border = 'none';
|
|
15
15
|
}
|
|
16
16
|
if (parent.nodeName === 'P') {
|
|
17
17
|
parent.style.textAlign = 'center';
|