Packer: what's the difference between tags and snapshot_tags builder options? - packer

From the documentation, they doing the same (https://www.packer.io/docs/builders/amazon-ebs.html#snapshot_tags)
Am I missing something?
In which case should I use snapshot_tags instead of tags?

According to the documentation:
tags - Tags applied to the AMI and relevant snapshots.
snapshot_tags - Tags to apply to snapshot. They will override AMI tags if already applied to snapshot.
Normally, you just need to set tags.

Related

How to configure stylelint to ban all HTML tags

Is there a way to configure stylelint to disallow all selectors which include tag names?
I found the (stylelint-selector-tag-no-without-class)[https://www.npmjs.com/package/stylelint-selector-tag-no-without-class] plugin, using which I want to ban ALL tag names, present and future, without listing each and every tag.
You can use the built-in selector-max-type rule to disallow all selectors which include tag names (aka type selectors):
{
"rules": {
"selector-max-type": 0
}
}
This will disallow all tag names, present and future, as the rule disallows selectors that are parsed as type selectors, rather than relying on some list of known type selectors.
Edit: #jeddy3's answer is better. Use that.
Configure the rule like so for all tags and custom elements: ​"plugin/selector-tag-no-without-class": ["/\\w+/"].
If you use BEM you'll want to allow __ and -- prefixes too: "plugin/selector-tag-no-without-class": ["/^(?!.__*).\\w+/"].
(Solution based on these SO answers: https://stackoverflow.com/a/28975388/915875 and https://stackoverflow.com/a/1240365/915875).

Can I add the pattern attribute to textarea?

I know that the textarea doesn't support the functionality of pattern, however if I set the pattern variable in html, its still present in the browser.
So I have to execute the pattern verification in js anyways, but is it OK for me to store the pattern in the pattern attribute? As opposed to data-pattern or something, for consistency with the input elements?
You should use data-* attributes for extra attributes and since textarea tag does not support the pattern attribute then adding it like adding value to div.
Hope this helps.
Custom attribute is suppose to have the data- prefix, so I recommend to use that or you could ran into issues when validating your code.
And what happens if such an attribute suddenly become a standard attribute?
More to read:
https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#data-*
https://www.w3.org/TR/2011/WD-html5-20110525/elements.html#embedding-custom-non-visible-data-with-the-data-attributes

P attribute inside <li> tag

I have seen this code from the tutorial that I'm studying. I searched for the purpose of the p attribute inside the li tag but found no answer. What is the purpose of that p attribute inside the li tag?
$msgs .= "<li p=\"$no_of_paginations\" class=\"inactive\">Last</li>";
The purpose cannot be inferred from the code snippet. As such, the attribute, being not defined in any HTML specification or draft or browser-specific extension, has no effect beyond being stored as data into the p element node in the document tree.
Such an attribute, though invalid by the specs, can be used like any other attribute in styling (e.g. attribute selector .p) in CSS or in scripting. In this case, it is probable, but by no means certain, that the attribute is meant to be used in scripting to carry a number as its value, with that number inserted with some server-side code, so that this value can be accessed in client-side scripting, as relating to a specific element.
The recommended way is to use data-* attributes instead, such as data-p, to avoid any risk of clashing with attribute names that might be introduced in some future HTML version.
The default HTML(whichever version) namespace doesn't have a purpose for "p" inside a li tag. If there's another namespace declared then that's where it's from. Other than that, it's not valid by w3 standards.
It should be a custom attribute to use in JavaScript codes to get something.
That is just a custom tag used in some javascript functions

Confusion on syntax for data attribute

I just need to know if this is the correct way of doing this.
I am trying to create an anchor tag that has an embedded image in it using a data attr. This will be used to determine what will be displayed at different media queries.
is this syntax correct? I have no idea. I am using bootstrap as my framework
<div class ="col-lg-12" data-test="<a href='http://www.army.mil/veterans/' target='_blank'><img id='va_badge' class ='badges img-responsive' src='images/armybadge.png' alt='Army Veteran Badge'></a>"> </div>
The syntax is correct. (You can check this using a validator like http://validator.w3.org) A data-* attribute may have any value. It may cpntain “<” characters, as they are not treated as starting a tag when inside an attribute value.
What you are going to do with the value is a completely different thing. It is all up to you. The data-* attributes are just containers for that that you can process with a script.

How do I control whether a HTML5 details tag is open or not with AngularJS

The HTML details tag is a collapsible chunk of content. You declare a closed (collapsed) details tag by writing
<details>Some stuff</details>
And an open (expanded) one by writing
<details open>Some stuff</details>
How do we dynamically add and remove attributes from a tag (in this case specifically the open attribute) with Angular?
Given that the <details> tag is not supported in many browsers you might want to consider using something else instead. This link shows how you can create an equivalent to the <details> tag which will work in all major browsers.
But otherwise, as #Tim Withers states, you should look to build a directive that will allow you to change this. Specifics depend on exactly how and when you are expecting to add/remove the attribute.
You just need to use ngOpen like so:
<details ng-open="boolean">