Skip to content

Commit

Permalink
fixes FremyCompany#60: occasionally css break-properties are ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
RonaldTreur committed Dec 7, 2020
1 parent d40c91b commit 40af30e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/css-regions/lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ module.exports = (function(window, document) { "use strict";
// return that sibling
return e.previousSibling;
},

//
// returns the previous sibling of the element
// or its parent if there are none
//
getAllLevelPreviousSiblingOrParent: function(e, region) {
if(!e || e==region) return null;

// if it has a previous sibling, return it
if (e.previousSibling) return e.previousSibling;

// else, if it exists and is not the region, return its parent
if(!e.parentNode || e.parentNode==region) return null;
return e.parentNode;
},

//
// prepares the element to become a css region
Expand Down
2 changes: 1 addition & 1 deletion src/css-regions/polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ module.exports = (function(window, document) { "use strict";
}

}
} while(current = cssRegionsHelpers.getAllLevelPreviousSibling(current, region));
} while(current = cssRegionsHelpers.getAllLevelPreviousSiblingOrParent(current, region));

// we're almost done! now, let's collect the ancestors to make some splitting postprocessing
var current = r.endContainer; var allAncestors=[];
Expand Down

0 comments on commit 40af30e

Please sign in to comment.