collective / collective/collective.markitup

preview_styler doesn't handle CSSRule.CHARSET_RULE

Open
#5 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Firefox 31.3.0/Plone 4.3.4/c.markitup 0.2: stylesheets can begin with a declaration like

```
@CHARSET "utf-8";
```

but unless they happen to be the first stylesheet, copying the rule in `preview_styles.js` only results in

> HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy preview_styler.js (line 20)

Workaround fix is

```
} else {
if (r.type != CSSRule.CHARSET_RULE){ // new
ss.insertRule(r.cssText, rule_index++);
} // new
}
```

but that's really just a band-aid.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with preview_styles.js and the insertion failure reported at preview_styler.js line 20. Reproduce the case with an @CHARSET declaration in a stylesheet that is not first, then verify the preview handles the rule without the reported HierarchyRequestError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.