Skip to content

Alternative style encapsulation technique to iframe/shadow dom #149

Open
@robhrt7

Description

@robhrt7

Spec pages with source_example sandboxes are built in such way that SourceJS engine scope should not touch interfere with global CSS and JS. With CSS it's achieved thanks to complex mixins, that resets all global CSS and re-apply local, without touching .source_example > *, and JS will be totally hidden behind single JS object in 0.6.

The best way to encapsulate components and SourceJS UI is to use iframes or shadow DOM (which we already planned to investigate #80), but I'm afraid this techniques could affect performance, since Shadow Dom could be done only client side, and iframes have various limitation.

I'm proposing an alternative way instead of complex LESS mixins for managing CSS - we can process all the simple tags on the server, adding custom classes like .sourcejs_tag-p. This will allow to remove a lot of hacks for styling SourceJS UI and help to reduce the complexity of custom theming.

We still should investigate solution with Shadow DOM encapsulation, at least in experimental or plugin mode. But if it won't be stable enough, we should go for tag classes processing approach.

We're planning a redesign around v.0.7, and style encapsulation refactoring most likely will be the main feature of upcoming version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions