Report an issue
Class

CKEDITOR.tools.style.parse

class since 4.6.1

The namespace with helper functions to parse some common CSS properties.

Filtering

Methods

  • background( value ) → Object

    Parses the value used as a background property shorthand and returns information as an object.

    Note: Currently only the color property is extracted. Any other parts will go into the unprocessed property.

    var background = CKEDITOR.tools.style.parse.background( '#0C0 url(foo.png)' );
    console.log( background );
    // Logs: { color: '#0C0', unprocessed: 'url(foo.png)' }
    

    Parameters

    value : String

    The value of the background property.

    Returns

    Object

    An object with information extracted from the background.

    Properties
    color : String

    The first color value found. The color format remains the same as in input.

    unprocessed : String

    The remaining part of the value that has not been processed.

  • border( value ) → Object

    Parses the border CSS property shorthand format. This CSS property does not support inheritance (https://www.w3.org/TR/css3-background/#the-border-shorthands).

    console.log( CKEDITOR.tools.style.parse.border( '3px solid #ffeedd' ) );
    // Logs: { width: "3px", style: "solid", color: "#ffeedd" }
    

    Parameters

    value : String

    The border property value.

    Returns

    Object
    Properties
    width : String

    The border-width attribute.

    style : String

    The border-style attribute.

    color : String

    The border-color attribute.

  • margin( value ) → Object

    Parses the margin CSS property shorthand format.

    console.log( CKEDITOR.tools.parse.margin( '3px 0 2' ) );
    // Logs: { top: "3px", right: "0", bottom: "2", left: "0" }
    

    Parameters

    value : String

    The margin property value.

    Returns

    Object
    Properties
    top : Number

    Top margin.

    right : Number

    Right margin.

    bottom : Number

    Bottom margin.

    left : Number

    Left margin.

  • _findColor( value ) → String[]

    private

    Searches the value for any CSS color occurrences and returns it.

    Parameters

    value : String

    Returns

    String[]

    An array of matched results.