Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<col> custom element problem #93

Open
dudeonthehorse opened this issue Nov 25, 2017 · 0 comments
Open

<col> custom element problem #93

dudeonthehorse opened this issue Nov 25, 2017 · 0 comments

Comments

@dudeonthehorse
Copy link

Hello

What I did:

  1. Removed Inky.prototype.makeColumn from inky.js
  2. Declared col and column elements in inky.js
this.components = extend({
      col: 'col',
      column: 'column'
  }, options.components || {});
  1. Added components to componentFactory.js
// <col>
case this.components.col:

    var classes = ['col'];
    return format('<div %s class="%s"><table width="100%"><tr><td class="cell">%s</td></tr></table></div>', attrs, classes.join(' '), inner);

// <column>
case this.components.column:

    var classes = ['column'];
    if (element.attr('class')) {
        classes = classes.concat(element.attr('class').split(' '));
    }

    return format('<div %s class="%s"><table width="100%"><tr><td class="cell">%s</td></tr></table></div>', attrs, classes.join(' '), inner);
  1. input.html
<col>
    <p>Hello, world!</p>
</col>

<column>
    <p>Hello, world!</p>
</column>
  1. output.html
<!-- Shitty element -->
<div class="col">
    <table width="100%">
        <tbody><tr>
            <td class="cell"></td>
        </tr>
    </tbody></table>
</div>
<p>Hello, world!</p>

<!-- Sexy element -->
<div class="column">
    <table width="100%">
        <tbody><tr>
            <td class="cell">
                <p>Hello, world!</p>
            </td>
        </tr>
    </tbody></table>
</div>

How can I fix this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant