Skip to content

Commit

Permalink
atto_styles: Try parent node if no class attribute when removing styles
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyjbutler committed Apr 29, 2024
1 parent 7b9ef40 commit d4f7a10
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,12 @@ Y.namespace('M.atto_styles').Button = Y.Base.create('button', Y.M.editor_atto.Ed
return;
}
for (p = element; p; p = p.parentNode) {
if (p.nodeType !== 1) {
if (p.nodeType !== 1 || !p.getAttribute('class')) {
continue;
}
if (p.getAttribute('class').search('editor_atto_content') != -1) {
break;
}
pstyle = window.getComputedStyle(p, null);
if (pstyle) {
p.removeAttribute('class');
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,12 @@ Y.namespace('M.atto_styles').Button = Y.Base.create('button', Y.M.editor_atto.Ed
return;
}
for (p = element; p; p = p.parentNode) {
if (p.nodeType !== 1) {
if (p.nodeType !== 1 || !p.getAttribute('class')) {
continue;
}
if (p.getAttribute('class').search('editor_atto_content') != -1) {
break;
}
pstyle = window.getComputedStyle(p, null);
if (pstyle) {
p.removeAttribute('class');
Expand Down
5 changes: 4 additions & 1 deletion yui/src/button/js/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,12 @@ Y.namespace('M.atto_styles').Button = Y.Base.create('button', Y.M.editor_atto.Ed
return;
}
for (p = element; p; p = p.parentNode) {
if (p.nodeType !== 1) {
if (p.nodeType !== 1 || !p.getAttribute('class')) {
continue;
}
if (p.getAttribute('class').search('editor_atto_content') != -1) {
break;
}
pstyle = window.getComputedStyle(p, null);
if (pstyle) {
p.removeAttribute('class');
Expand Down

0 comments on commit d4f7a10

Please sign in to comment.