Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it legal to create your own CSS attributes?

I'm working on a windowing application for a website of mine. Right now, I have each individual window set up as a in the body of the site. I add new windows by literally adding the appropriate code to the end of the body element, and delete them by removing that div. (I'm using jQuery for the underlying JavaScript architecture.)

I've found that for each window, I want to be able to store some values that aren't used directly. Say I maximize a window, I would want to save its old position and size so that when I un-maximize it, it returns to its old position and not just to somewhere random. So my real question here is, would it be legal to create custom CSS attributes (knowing full well that the browser would ignore them) with the sole purpose of keeping information like this on a per-div basis? Or would this be illegal, and should I look at another alternative?

I'm certainly familiar with methods of keeping all of this in an array so the system can run blind with it, but that's lovely and prone to errors and things, and it would still be a bit tricky to work with.

Thanks

like image 684
Nicholas Flynt Avatar asked Dec 08 '22 07:12

Nicholas Flynt


1 Answers

I would use jQuery's data() method instead for storing temp data.

$('div#window').data('position', { x: 100, y: 200, width: 50, height: 50});
$('div#window').data('state', 'minimized');

References:

  • http://docs.jquery.com/Core/data
  • http://docs.jquery.com/Core/removeData

You can also make this data persistent by storing it in cookies or in session at server side and restore it on the client when page loads. This way, window’s position and state will be kept even if user reloads the page.

like image 74
Konstantin Tarkus Avatar answered Dec 26 '22 21:12

Konstantin Tarkus