AngularJS custom attributes [duplicate] - javascript

This question already has answers here:
Should I care about W3C validation?
(9 answers)
Closed 4 years ago.
I am new to angularjs. Just wanted to know that why does custom attributes which angularjs add to html element doesn't give any error? <div ng-if='true'>
Also, is it possible for us to create our own custom attributes for html elements?
Thanks.

They will not give an error because it is how they should be used and for your question about creating custom attributes I am almost sure that it is impossible

Related

Textarea html tag with support `css` code [duplicate]

This question already has answers here:
Textarea that can do syntax highlighting on the fly?
(11 answers)
Closed 2 years ago.
I'm looking for textarea so I can write css code inside it. And have a good graphic appearance for displaying css code
As in the picture below:
There can be really one of two ways to do that: either you will implement it yourself OR use ready made libraries. Solutions like that exist in great variety and it could save you a lot of time to use one of following or find a similar one:
Edit Area
highlight.js
CodeMirror

Why using "document.getElementById" instead of using the ID to refer to elements in JavaScript? [duplicate]

This question already has answers here:
Do DOM tree elements with IDs become global properties?
(5 answers)
What is the difference between getElementById and simply using an element's ID as a variable?
(2 answers)
Closed 5 years ago.
So, I was coding in class when accidentally got to this point, when you set any ID in HTML5 a global variable is created at the same time, which can be used on the script aparently the same way we use getElementById().
for example:
<div id="identifier"></div>
can be accessed in the script like:
identifier.style.whatever
Can anyone explain me why I can't find any information about this? also, why isn't anyone using this when coding? is it bad to use this instead of getElementById?

What would be the pure JavaScript alternative to this jQuery selector? [duplicate]

This question already has answers here:
Lightweight alternative to jQuery for class / id selecting
(6 answers)
Closed 8 years ago.
I have this jQuery selector:
$('#stuffElements').find('[data-markerlayer="layer1"]');
I have a ton of selectors similar to this one, and I want to optimize my script as much as possible, as rewriting most selectors requires only minimal effort on my part.
Disregarding the discussion whether this is useful, is it possible to write the above selector out in pure JavaScript?
document.querySelectorAll('#stuffElements [data-markerlayer="layer1"]')
or to make it more efficient:
var holder = document.getElementById('#stuffElements'); // cache parent node
holder.querySelectorAll('[data-markerlayer="layer1"]'); // finds inside it
querySelectorAll doesn't work in IE7 if that bothers you.

What is the difference between data-ng and ng? [duplicate]

This question already has answers here:
What is the difference between ng-app and data-ng-app?
(7 answers)
Closed 9 years ago.
I have read that the difference between
ng-* and data-ng-*
in Angularjs is, that you get valid HTML if you use data-ng-*.
But why do I need that if I can declare the angular namespace in just one single line?
<html xmlns:ng="http://angularjs.org" ng-app>
Or is it just for validating with an HTML Validator?
Excuse my stupidity, but I'm really confused about this.
It's just for validation of your HTML. No other purpose.

Get List of all classes affecting a element including derived classes [duplicate]

This question already has answers here:
Can jQuery get all CSS styles associated with an element?
(5 answers)
Closed 8 years ago.
I want to get the list of all stylesheet rules that is affecting the current element.
Something like what firebug or native inspect element does.
brothercake.com/site/resources/scripts/cssutilities

Categories