raspu / Highlightr

iOS & OSX Syntax Highlighter.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Non-deterministic rendering in fast renderer

kabiroberai opened this issue · comments

When rendering nested classes, the fast renderer determines which style takes precedence in a non-deterministic manner.

Eg.
xcode.css has the following definitions (simplified here for the sake of brevity):

.hljs-title {
  color: blue;
}

.hljs-class .hljs-title {
  color: purple;
}

The following JS snippet

class Foo

is converted to

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Foo</span></span>

In the aforementioned snippet, Foo should turn purple, however in reality the renderer randomly picks between blue and purple, and the color it picks varies between app launches.

Seriously? That's a really interesting issue! I will take a look at it when I find some time.