forked from druids/werkzeug
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLink.coffee
52 lines (44 loc) · 965 Bytes
/
Link.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
goog.require 'wzk.ui.LinkRenderer'
class wzk.ui.Link extends wzk.ui.Component
###*
@param {Object} params
renderer: {wzk.ui.LinkRenderer}
href: {string}
title: {string}
target: {string}
caption: {string} an escapted caption
htmlCaption: {string} a non-escapted caption, it overrides a caption
###
constructor: (params) ->
params.renderer ?= wzk.ui.LinkRenderer.getInstance()
super params
{@href, @caption, @htmlCaption, @title, @target} = params
@href ?= ''
@caption ?= ''
@htmlCaption ?= ''
@title ?= @caption
###*
@return {string}
###
getHref: ->
@href
###*
@return {string}
###
getTitle: ->
@title
###*
@return {string}
###
getTarget: ->
@target
###*
@return {string}
###
getHTMLCaption: ->
@htmlCaption
###*
@return {string}
###
getContent: ->
if @getElement() then @dom.getTextContent(@getElement()) else ''