Delven does implicit conversions for complex types.
What this means is that when we use a selector such as css('a')
we are actually selecting a HTMLElement not the value associated with the elements, so in order to get the value we follow some rules to do that.
Implicit conversion is ENABLED
by default, to disable it we can use the OPTIONS
clause.
SELECT css("#id1") FROM http://www.delven.io/test/index-01.html
OPTIONS
{
"implicit-conversion" : false
}
When conversion is ENABLED
following two selectors are equivalent.
css('a') -> css('a:value')
They both will return text value of the link. Note the use of Selector Extension :value
which can be always used to select actual value of an element regardles of conversion being ENABLED
or DISABLED
<a>
Tag<a href="https://www.delven.io" data-content="Some Content">PhantomSQL</a>
css('a') -> css('a:value')
CONVERSION ENABLED
{
"value": "Delven"
}
CONVERSION DISABLED
{
"value": "Delven",
"href": "https://www.delven.io",
"data-content": "Some Content"
}
<input>
Tag <input type="text" id="firstname" value="Greg">
css('#firstname')
CONVERSION ENABLED
{
"value" : "Greg"
}
CONVERSION DISABLED
{
"value" : "Greg",
"type" : "text",
"id" : "firstname"
}