Is use of data attribute for background image considered inline css?

Hello all authors, I hope my question is reasonable as I couldn’t find any discussions about this.
Is using a custom data-background attribute on a given element to set an image as a background to that element considered inline styling (which is not allowed of course)?
To be exact this is my javascript:
setBackground.each(function () { if ($(this).attr('data-background')) { $(this).css('background-image', 'url(' + $(this).data('background') + ')'); } });
As we can see the code will result in an element that has its background set by js in inline style.
I think I already know the answer, but the line is pretty thin to be honest.

Inline CSS is allowed in specific cases like dynamic image background, or any dynamic data in general.
Which means you do not have to “hack” it via JS like in your example. Just put it in style attribute directly in your PHP code.


Thank you for the reply, I will follow your advice.