whowish_word 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,7 @@ var WhowishWordElementCreator = WhowishWordCreator.extend({
11
11
  $w(editIcon).attr('id', this.getEditIconId(attrs[i]));
12
12
  $w(editIcon).attr('title', attrs[i]);
13
13
 
14
- var whowishWordIdPackage = whowishWordHelper.extractWhowishWordIdFromText(this.element[attrs[i]]);
14
+ var whowishWordIdPackage = whowishWordHelper.extractWhowishWordIdFromText($w(this.element).attr(attrs[i]));
15
15
  var idPackage = whowishWordHelper.parseWhowishWordIdPackage(whowishWordIdPackage);
16
16
 
17
17
  editIcon.whowishWord = {};
@@ -32,9 +32,19 @@ var WhowishWordElementCreator = WhowishWordCreator.extend({
32
32
  var attrs = this.getRelevantAttributes();
33
33
 
34
34
  for (var i=0;i<attrs.length;i++) {
35
- var newValue = this.element[attrs[i]].replace(whowishWordVariables.attributeValuePattern,"$2");
36
- this.element.attributes[attrs[i]].value = newValue;
37
- this.element[attrs[i]] = newValue;
35
+
36
+ var newValue = $w(this.element).attr(attrs[i]).replace(whowishWordVariables.attributeValuePattern,"$2");
37
+
38
+ try {
39
+ this.element[attrs[i]] = newValue;
40
+ } catch(e) {}
41
+
42
+ try {
43
+ this.element.attributes[attrs[i]].value = newValue;
44
+ } catch (e) {}
45
+
46
+ $w(this.element).attr(attrs[i], newValue);
47
+
38
48
  }
39
49
 
40
50
  },
@@ -6,12 +6,20 @@ var WhowishWordAttributeHandler = WhowishWordContentHandler.extend({
6
6
  },
7
7
 
8
8
  setContent: function(content){
9
- this.element[this.attributeName] = content;
10
- this.element.attributes[this.attributeName].value = content;
9
+
10
+ try {
11
+ this.element[this.attributeName] = content;
12
+ } catch(e) {}
13
+
14
+ try {
15
+ this.element.attributes[this.attributeName].value = content;
16
+ } catch (e) {}
17
+
18
+ $w(this.element).attr(this.attributeName, content);
11
19
  },
12
20
 
13
21
  getContent: function(){
14
- return this.element[this.attributeName];
22
+ return $(this.element).attr(this.attributeName);
15
23
  }
16
24
 
17
25
  });
@@ -24,23 +24,23 @@
24
24
  <input type="text" name="some_textbox">
25
25
  </span>
26
26
  <span>
27
- <b>Textbox: </b> <input type="textbox"
27
+ <b>Textbox: </b> <input type="textbox" name="<%=rand(1000)%>"
28
28
  title="<%=word_for_attr :textbox_title%>"
29
29
  value="<%=word_for_attr :textbox_value%>"
30
30
  placeholder="<%=word_for_attr :textbox_placeholder%>">
31
31
  </span>
32
32
  <span>
33
- <b>Textarea: </b> <textarea
33
+ <b>Textarea: </b> <textarea name="<%=rand(1000)%>"
34
34
  title="<%=word_for_attr :textarea_title%>"
35
35
  placeholder="<%=word_for_attr :textarea_placeholder%>"><%=word_for_attr :textarea_value%></textarea>
36
36
  </span>
37
37
  <span>
38
- <b>Checkbox: </b> <input type="checkbox"
38
+ <b>Checkbox: </b> <input type="checkbox" name="<%=rand(1000)%>"
39
39
  title="<%=word_for_attr :checkbox_title%>"
40
40
  value="<%=word_for_attr :checkbox_value%>">
41
41
  </span>
42
42
  <span>
43
- <b>Radio: </b> <input type="radio"
43
+ <b>Radio: </b> <input type="radio" name="<%=rand(1000)%>"
44
44
  title="<%=word_for_attr :radio_title%>"
45
45
  value="<%=word_for_attr :radio_value%>">
46
46
  </span>
@@ -75,7 +75,7 @@
75
75
  </script>
76
76
  </span>
77
77
  <span>
78
- <b>Late Textbox: </b> <input type="textbox" id="late_textbox"
78
+ <b>Late Textbox: </b> <input type="textbox" id="late_textbox" name="<%=rand(1000)%>"
79
79
  title="title"
80
80
  value="value"
81
81
  placeholder="placeholder">
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "whowish_word"
6
- s.version = "0.1.2"
6
+ s.version = "0.1.3"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Tanin Na Nakorn"]
9
9
  s.email = ["tanin47@yahoo.com"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whowish_word
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: