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

Cannot set dynamic values to ClassApplier properties #469

Open
azoof-ahmed opened this issue Dec 13, 2020 · 1 comment
Open

Cannot set dynamic values to ClassApplier properties #469

azoof-ahmed opened this issue Dec 13, 2020 · 1 comment

Comments

@azoof-ahmed
Copy link

I tried to assign a variable and a function returning a string to the elementProperties and it doesn't work. When setting attempting to use a function it sets the function definition in string format o_O and setting a variable does nothing when its clearly got a value

highlighter.addClassApplier(
      rangy.createClassApplier('note', {
        ignoreWhiteSpace: true,
        elementTagName: 'a',
        elementProperties: {
          href: '#',
          title: noteText,
        },
      })
    );
@azoof-ahmed
Copy link
Author

elementAttributes[attrName] = "" + attrValue;

issue with this line. forces whatever is passed to turn into a string. Wouldn't it be better to just check if the value or whatever is passed is a string instead of doing this

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