Jorge Rimblas
Senior APEX Consultant
Age: 14 years!
Staff: 80+ employees
60 consultants/developers
APEX Solutions: 12 Years!
Largest APEX practice in North America
Oracle Center of Excellence
In CSS
biggest issue
Just heard this one from someone at @AmsterdamPHP: "Java is to Javascript like what ham is to hamster" 😂👍
— Claudio Dekker (@ClaudioDekker) February 16, 2017
Java is to JavaScript
as
Ham is to Hamster
Operator | JavaScript | PL/SQL |
---|---|---|
assignment | = | := |
equality | == | = |
if (i = 1) {
...
}
if (1) {
...
if (i = 1) then
...
PL/SQL
JS
=== !==
== !=
'' == '0' // false
0 == '' // true
0 == '0' // true
false == 'false' // false
false == '0' // true
false == undefined // false
false == null // false
null == undefined // true
' \t\r\n ' == 0 // true
Operator | JavaScript | PL/SQL |
---|---|---|
assignment | = | := |
strict equality | === | = |
strict inequality | !== | != <> |
Operator | JavaScript | PL/SQL |
---|---|---|
or | || | or |
concatenation | + | || |
Addition | + | + |
0 + 0 // 0
"0" + 0 // "00"
"0" + "0" // "00"
0 + "0" // "00"
Operator | JavaScript | PL/SQL |
---|---|---|
++ | v++ ++v |
v := v+1; |
-- | v-- --v |
v := v-1; |
var i = 5;
++i + 4 // = 10, i = 6
i++ + 4 // = 9, i = 6
function foo(n) {
i = n;
}
function foo(n number)
return number
is
i number;
begin
i := n;
end foo;
JS
PL/SQL
function foo(n number)
return number
is
i number;
begin
i := n;
return i;
end foo;
ORA-06503: PL/SQL: Function returned without value
function foo(x, y) {
return x * y;
}
foo(1,2);
// 2
Definition
foo(1,2,7,8);
// 2
foo(5);
// NaN
function foo(x, y) {
return x * y;
}
Definition
var foo = function (x, y) {
return x * y;
}
also a function
typeof foo;
// function
eval
It's always a no-no. Big security risk
jQuery is a fast, small, and feature-rich JavaScript library.
It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an
easy-to-use API that works across a multitude of browsers.
With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.
Source: jquery.com
$ === apex.jQuery
$("div");
apex.jQuery("div");
In CSS
biggest issue
Content
Padding
Border
Margin
<div>Content</div>
div {
width: 320px; height: 50px;
padding: 10px;
}
div {
width: 320px; height: 50px;
}
div {
width: 320px; height: 50px;
padding: 10px;
border: 5px solid gray;
}
div {
width: 320px; height: 50px;
padding: 10px;
border: 5px solid gray;
margin: 7px;
}
div {
width: 320px;
padding: 10px;
border: 5px solid gray;
margin: 0;
}
320px (width)
+ 20px (left + right padding)
+ 10px (left + right border)
+ 0px (left + right margin)
= 350px
Total width?
div {
width: 320px;
padding: 10px;
border: 5px solid gray;
margin: 0;
}
selector
property
value
property
value
jQuery selector
div {
padding: 10px;
}
div {
padding: 10px 10px 10px 10px;
}
top
bottom
right
left
shorthand
div {
padding: 5px 10px;
}
div {
padding: 5px 10px 5px 10px;
}
top
bottom
right
left
top
right
bottom
left
div {
padding: 5px 10px 5px 10px;
}
top
right
bottom
left
div {
padding-top: 5px;
padding-right: 10px;
padding-bottom: 5px;
padding-left: 10px;
}
select *
from emp
where deptno = 20
select element
from {Page HTML}
* {
...
}
select element
from {Page HTML}
where id = 'PK'
#PK {
...
}
<div id="emps" class="t-Region">
...
</div>
#emps {
color: red;
}
select element
from {Page HTML}
where job = 'SALES'
.sales {
...
}
<div id="emps" class="t-Region">
...
</div>
.t-Region {
color: red;
}
<td class="t-Report-cell" headers="EMPNO">
...
</td>
td[headers="EMPNO"] {
color: red;
}
~=
|=
^=
$=
select element
from {Page HTML}
where deptno = 20
div {
...
}
<div id="emps" class="t-Region">
...
</div>
div {
color: red;
}
<div id="emps" class="t-Region t-Region--removeHeader">
...
</div>
.t-Region {
background-color: white;
}
#emps {
background-color: gray;
}
div {
background-color: blue;
}
<div id="emps" class="t-Region t-Region--removeHeader">
...
</div>
.t-Region {
background-color: white;
border: 1px solid black;
}
.t-Region {
background-color: gray;
}
<div id="emps" class="t-Region t-Region--accent5"
style="background-color: green;">
...
</div>
.t-Region {
background-color: white;
}
.t-Region.t-Region--accent5 {
background-color: gray;
}
#emps {
background-color: blue;
}
.t-Region {...}
$(".t-Region");
.t-Region.t-Region--accent5 {...}
$(".t-Region.t-Region--accent5");
CSS
jQuery
CSS
jQuery
#emps {...}
$("#emps");
CSS
jQuery
$(".t-Region").hide();
$(".t-Region").remove();
$(".t-LinksList-item").toggleClass("is-current");
$("#emp").find("li").removeClass("is-current");
Style Attribute | Most Specific |
ID | |
Class, Attribute | |
Elements | Least Specific |
* https://css-tricks.com/specifics-on-css-specificity/
<div id="emps" class="t-Region t-Region--accent5"
style="background-color: green;">
...
</div>
.t-Region {
background-color: white!important;
}
.t-Region.t-Region--accent5 {
background-color: gray;
}
#emps {
background-color: blue;
}
Best approach!
Jorge Rimblas
Twitter: @rimblas