Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Better (or actually proper) handling of absent width/height
  • Loading branch information
shafirov committed Mar 19, 2013
1 parent c33fb25 commit 9916e2c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/KaraLib/src/kara/views/BodyTags.kt
Expand Up @@ -182,12 +182,12 @@ abstract class BodyTag(name : String, isEmpty : Boolean) : TagWithText(name, isE
} }
} }


fun img(c : StyleClass? = null, id : String = "" , width : Int = 0, height : Int = 0, src : Link? = null, alt : String = "") { fun img(c : StyleClass? = null, id : String = "" , width : Int? = null, height : Int? = null, src : Link? = null, alt : String = "") {
val tag = IMG() val tag = IMG()
tag.id = id tag.id = id
if (c != null) tag.c = c if (c != null) tag.c = c
tag.width = width if (width != null) tag.width = width
tag.height = height if (height != null) tag.height = height
if (src != null) tag.src = src if (src != null) tag.src = src
tag.alt = alt tag.alt = alt


Expand Down Expand Up @@ -267,13 +267,13 @@ abstract class BodyTag(name : String, isEmpty : Boolean) : TagWithText(name, isE
initTag(tag, init) initTag(tag, init)
} }


fun textarea(text : String = "", c : StyleClass? = null, id : String = "" , rows : Int = 0, cols : Int = 0, name : String = "", init : TEXTAREA.() -> Unit = empty_init) { fun textarea(text : String = "", c : StyleClass? = null, id : String = "" , rows : Int? = null, cols : Int? = null, name : String = "", init : TEXTAREA.() -> Unit = empty_init) {
val tag = TEXTAREA() val tag = TEXTAREA()
tag.id = id tag.id = id
if (c != null) tag.c = c if (c != null) tag.c = c
tag.cols = cols if (rows != null) tag.rows = rows
tag.name = name if (cols != null) tag.cols = cols
tag.rows = rows tag.name = name
initTag(tag, init) initTag(tag, init)
if (tag.children.size == 0) { if (tag.children.size == 0) {
tag.text = text tag.text = text
Expand Down

0 comments on commit 9916e2c

Please sign in to comment.