How do I fix Emmet's code snippets for transition-duration? - emmet

One of the snippets in Emmet for Brackets is -transition-duration. When you press tab after it, it's supposed to come up with this:
-webkit-transition-duration: ;
-moz-transition-duration: ;
-ms-transition-duration: ;
-o-transition-duration: ;
transition-duration: ;
However, whenever I use it, all I get is this:
-webkit-transition-duration: ;
-o-transition-duration: ;
transition-duration: ;
The same thing happens with
-transition-delay
and
-transform
I have tried removing and re-adding Emmet, but it didn't work for me. Could someone please tell me what to do to fix this?

Emmet uses Can I Use database to generate vendor prefixes. If you consult this database, you’ll see that there’s no -ms-transition-duration at all and -moz-transition-duration is supported by <0.1% browsers in a wild.
If you still think you have to use all selectors, you should create your own snipptes as described here: http://docs.emmet.io/customization/snippets/

Related

How to find an element containing #nbsp; in text?

I've an element with html -
<h3>App-1 Playground Login</h3>
I want to identify it with entire text - App-1 Playground Login, but causing issues to identify it. Please help how this element can be identified.
Please use the below xpath. I have already tested that and it is working fine. In the second argument of the translate method you need to type "ALT+0160" and in the third argument you will have to put just a normal space.
//h3[contains(translate(text(),' ',' ' ), 'App-1 Playground Login')]
One of the way to select your title could be :
//h3[text()= concat('App-1 Playground',codepoints-to-string(160),'Login')]
Works fine on http://xpather.com/

'Input' does not contain a definition for 'GetMouseButton' how is this possible?

I've wanted to try developing for touch screen but for some reason it said:
'Input' does not contain a definition for 'touched'
Then I tried with the old fashioned way, which worked for me a million times, but now doesn't.
'Input' does not contain a definition for 'GetMouseButton'
Does someone know the source of my problem?
void Update() {
if(Input.GetMouseButton(0))
Debug.Log("Pressed left click.");
if(Input.GetMouseButton(1))
Debug.Log("Pressed right click.");
if(Input.GetMouseButton(2))
Debug.Log("Pressed middle click.");
}
Oh my god, I am so stupid.
I've already reinstalled Unity, VS and everything maybe twice.
And I didn't see what caused the problem...
The problem was that I named my script 'Input'
Oh my GOOOOD

Dynamic xpath handling

Below is my xpath
driver.findElement(By.xpath("html/body/div[9]/div/a/div")).click();
In above code value of div[6] is keep changing.
Sometimes it will
driver.findElement(By.xpath("html/body/div[6]/div/a/div")).click();
or
driver.findElement(By.xpath("html/body/div[1]/div/a/div")).click();
Please provide solution.
We faced this issue with dynamic page content making XPath identification basically useless. We took the decision to make sure everything that needed to be identified in a test would have an id set. So:
driver.findElement(By.xpath("html/body/div[6]/div/a/div")).click();
becomes:
driver.findElement(By.id("myDivId")).click();
Use div 'id' or 'class' instead of div[6].
like:
/html/body/div[#id='div_id']/div/a/div
(or)
/html/body/div[#class='div_className']/div/a/div

XPath query search

Such structure is given
<div class="user-number">123</div>
<div class="user-state">
<span class="u-state-icon icon icon-1"></span>
<span> User1</span>
</div>
I've tried such (incorrect) xpath for locating User1 by user-number and do not understand where is the problem..
xpath=//*[#class='user-number' and text() = '123']/following-sibling::*[contains(#class,'user-state')]/descendant::*[contains(#text,'User1')]
What is the best way to debug it?
For example, if
xpath=//*[#class='user-number' and text() = '123']/following-sibling::*[contains(#class,'user-state')]
locates some element - how to print out its text property - to check which element is actually located?
Your xpath expression is, surely, incorrect - #text should be replaced with text() (or just .):
//*[#class='user-number' and . = '123']/following-sibling::*[contains(#class,'user-state')]/descendant::*[contains(.,'User1')]
Debugging xpath expressions is usually done using the browser developer tools: in the firebug, or inside a browser console. For instance, in the google-chrome console, you can execute the following:
$x("//*[#class='user-number' and . = '123']/following-sibling::*[contains(#class,'user-state')")
And see if there is a match.
Or, you can also debug it inside your code. For example (using python), find the first div element and print out it's text:
element = driver.find_element_by_xpath("//*[#class='user-number' and . = '123']")
print(element.text)
The meta-question is, how to debug XPath expressions?
Well, for simple ones like these, it's really best to just stare at them till you see the problem. Check the spelling of names, check namespaces, check whitespace issues. At least it's easier than debugging regular expressions.
For more complex XPaths, try breaking them up. Remove a predicate and see if that makes a difference. Or work in reverse, build up the path expression by adding conditions, checking at each stage that it still finds something.
If you're really seriously into XPath, consider schema-aware processing: this will match your XPath expression against a schema to make sure it makes sense.
Consider using a visual XPath processor for debugging. There are a number around. I use the XPath processor in oXygen (though not really for debugging the XPath, more for discovering the content of the document, but those tasks often need to be done together.)

How could I escape a & in Haml so that it compiles to & instead of &? (Haml noob)

I am trying to use the Icomoon icon font with Haml and can't seem to find a way to escape the & so that it stays just an & instead of &.
The Icomoon font allows you to use HTML entities with a data-icon="" attribute. Works smooth as butter in HTML and even in a Haml file if I just do a straight HTML link.
However, since I'm learning Haml I thought I'd see if anyone on here would like to recommend the best way to approach this.
Here's a sample of what happens.
This is the original Haml:
%a(href='/posts' data-icon="&#x0026" aria-hidden='true')
This is how it compiles:
<a aria-hidden='true' data-icon='&#x0026' href='/posts'>
This is how it needs to compile for the icon font to work:
<a aria-hidden='true' data-icon='&#x0026' href='/posts'>
and here is a codepen where you can see how the icon renders due to the amp; addition: http://codepen.io/dandenney/pen/3/6
I didn't like the top poster's way of completing this question. So far the best way I've found is to do:
- foo = "&#x0026".html_safe
%a(href='/posts' data-icon=foo aria-hidden='true')
I'm not fully happy with this, but think it's better for rails apps rather than turning off HTML escaping everywhere.
You can use the :escape_attrs option to control whether HTML sensitive characters in attributes are escaped:
require 'haml'
haml = "%a(href='/posts' data-icon=\"&#x0026\" aria-hidden='true')"
puts Haml::Engine.new(haml, :escape_attrs => false).to_html
Output:
<a aria-hidden='true' data-icon='&#x0026' href='/posts'></a>
Note that this will apply to all attributes in your Haml template.
In my opinion, I don't like the idea to disable the feature to escape the characters generally. Maybe you use relay at some point in your application on it.
For me the best way to do it is:
%a{ href: '/', 'data-icon' => "✐".html_safe }