High-Performance UI Component Library for Enterprise Applications Forums General Discussions text item with attributes appears to be inconsistant

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #113658
    edwardsmarkff
    Participant

    hello –

    this is very minor but before proceeding, i wanted to ask something about <smart-input

    https://codepen.io/edwardsmarkf/pen/myWevNv?editors=1111

    please notice in my example, that to reference an attribute (getAttr) using html inline embedded code, you must include “data-“ but if you use setAttr, you do not.

    my first workaround thought is something like:

    item.getAttr('test') ? item.getAttr('test') : item.getAttr('data-test');

    but i would appreciate any input from the community.

    note:  I 💌 smart-html-elements!

    #113663
    edwardsmarkff
    Participant

    i am guessing the best solution is to completely STOP using inline data-testitem='tester' and ONLY use item.setAttribute().

    #113664
    admin
    Keymaster

    Hi,

    What is the idea of the provided code? What do you try to achieve with it? In JS, it’d be better to use setAttribute and getAttribute to get/set attributes. If you set custom attributes, it’s better to use data- notation.

    Regards,
    Markov

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.