Skip to content

Commit

Permalink
ace2_inner: Get computed style of first Element, not first Node
Browse files Browse the repository at this point in the history
`window.getComputedStyle()` throws if passed a non-Element Node.
  • Loading branch information
rhansen committed Aug 21, 2021
1 parent 7690dd6 commit f706699
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/static/js/ace2_inner.js
Original file line number Diff line number Diff line change
Expand Up @@ -3495,7 +3495,7 @@ function Ace2Inner(editorInfo, cssManagers) {
// use that for displaying the side div line number inline with the first line
// of content -- This is used in ep_headings, ep_font_size etc. where the line
// height is increased.
const elementStyle = window.getComputedStyle(docLine.firstChild);
const elementStyle = window.getComputedStyle(docLine.firstElementChild);
const lineHeight = parseInt(elementStyle.getPropertyValue('line-height'));
const marginBottom = parseInt(elementStyle.getPropertyValue('margin-bottom'));
lineHeights.push(lineHeight + marginBottom);
Expand Down

0 comments on commit f706699

Please sign in to comment.