{"action":"created","issue":{"url":"https://api.github.com/repos/aFarkas/lazysizes/issues/332","repository_url":"https://api.github.com/repos/aFarkas/lazysizes","labels_url":"https://api.github.com/repos/aFarkas/lazysizes/issues/332/labels{/name}","comments_url":"https://api.github.com/repos/aFarkas/lazysizes/issues/332/comments","events_url":"https://api.github.com/repos/aFarkas/lazysizes/issues/332/events","html_url":"https://github.com/aFarkas/lazysizes/issues/332","id":192778690,"number":332,"title":"Use \"data-ls-lazyload\" instead \"lazyload\" class","user":{"login":"rolandtoth","id":5349356,"avatar_url":"https://avatars.githubusercontent.com/u/5349356?v=3","gravatar_id":"","url":"https://api.github.com/users/rolandtoth","html_url":"https://github.com/rolandtoth","followers_url":"https://api.github.com/users/rolandtoth/followers","following_url":"https://api.github.com/users/rolandtoth/following{/other_user}","gists_url":"https://api.github.com/users/rolandtoth/gists{/gist_id}","starred_url":"https://api.github.com/users/rolandtoth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rolandtoth/subscriptions","organizations_url":"https://api.github.com/users/rolandtoth/orgs","repos_url":"https://api.github.com/users/rolandtoth/repos","events_url":"https://api.github.com/users/rolandtoth/events{/privacy}","received_events_url":"https://api.github.com/users/rolandtoth/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-01T08:06:53Z","updated_at":"2016-12-01T18:22:07Z","closed_at":null,"body":"Consider the following snippet:\r\n\r\n```php\r\n<img <?php echo functionToGenerateLazysizeAttributes(); ?> class=\"lazyload align-right\" />\r\n````\r\nThe function here generates all the attributes lazysizes needs but the lazyload class should be added manually. However, the function could also add the class but that would result in double class attributes.\r\n\r\nUsing \"data-ls-lazyload\" attribute could fix this:\r\n\r\n```php\r\n<img <?php echo functionToGenerateLazysizeAttributes(); ?> data-ls-lazyload class=\"align-right\" />\r\n````\r\n\r\nThe php function is part of a module in a CMS and it's configurable whether to include the \"lazyload\" class or not, but even so it often leads to confusion. The data attribute could easily solve it.\r\n\r\nI can create a PR if you wish."},"comment":{"url":"https://api.github.com/repos/aFarkas/lazysizes/issues/comments/264251339","html_url":"https://github.com/aFarkas/lazysizes/issues/332#issuecomment-264251339","issue_url":"https://api.github.com/repos/aFarkas/lazysizes/issues/332","id":264251339,"user":{"login":"aFarkas","id":188254,"avatar_url":"https://avatars.githubusercontent.com/u/188254?v=3","gravatar_id":"","url":"https://api.github.com/users/aFarkas","html_url":"https://github.com/aFarkas","followers_url":"https://api.github.com/users/aFarkas/followers","following_url":"https://api.github.com/users/aFarkas/following{/other_user}","gists_url":"https://api.github.com/users/aFarkas/gists{/gist_id}","starred_url":"https://api.github.com/users/aFarkas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aFarkas/subscriptions","organizations_url":"https://api.github.com/users/aFarkas/orgs","repos_url":"https://api.github.com/users/aFarkas/repos","events_url":"https://api.github.com/users/aFarkas/events{/privacy}","received_events_url":"https://api.github.com/users/aFarkas/received_events","type":"User","site_admin":false},"created_at":"2016-12-01T18:22:07Z","updated_at":"2016-12-01T18:22:07Z","body":"The answer is, that you can't switch this so easily. lazySizes uses live nodelists, which are returned by functions like `getElementsByTagName`/`getElementsByName` and `getElementsByClassName`. Methods like `querySelectorAll` only return static nodelists.\r\n\r\nThe best way is to change your php code:\r\n\r\n```\r\n//note i don't know how to create a map in php\r\n<img <?php echo functionToGenerateLazysizeAttributes({classes: 'align-right'}); ?> />\r\n```"}}
{"actor":{"display_login":"aFarkas"}}