@@ -69,10 +69,15 @@ if (!('CSSArrowPlease' in window)) window.CSSArrowPlease = {};
6969 hasBorder = borderWidth > 0 ,
7070 css = '.arrow_box {\n' ;
7171
72+ color = this . _sanitizeHexColors ( color ) ;
73+
7274 css += '\tposition: relative;\n' ;
7375 css += '\tbackground: ' + color + ';\n' ;
7476
75- if ( hasBorder ) css += '\tborder: ' + borderWidth + 'px solid ' + borderColor + ';\n' ;
77+ if ( hasBorder ) {
78+ borderColor = this . _sanitizeHexColors ( borderColor ) ;
79+ css += '\tborder: ' + borderWidth + 'px solid ' + borderColor + ';\n' ;
80+ }
7681
7782 css += '}\n' ;
7883 css += '.arrow_box:after' ;
@@ -111,6 +116,7 @@ if (!('CSSArrowPlease' in window)) window.CSSArrowPlease = {};
111116 @protected
112117 **/
113118 _arrowCSS : function ( color , size , layer ) {
119+ color = this . _sanitizeHexColors ( color ) ;
114120 var pos = this . get ( 'position' ) ,
115121 iPos = this . invertedPosition ( ) ,
116122 rgbColor = this . hexToRGB ( color ) ,
@@ -204,6 +210,16 @@ if (!('CSSArrowPlease' in window)) window.CSSArrowPlease = {};
204210 this . _attributes = attributes ;
205211 } ,
206212
213+ /**
214+ @method _sanitizeHexColors
215+ @description prefix hexcolors with # if necessary
216+ @returns {String } h
217+ @protected
218+ **/
219+ _sanitizeHexColors : function ( h ) {
220+ return ( h . charAt ( 0 ) === '#' ) ?h :'#' + h ;
221+ } ,
222+
207223 /**
208224 @method getAttrs
209225 @description returns all the attributes
0 commit comments